Spray foam, when installed by someone who knows what they're doing, doesn't cause damage thru expansion. It just needs to be sprayed a little at a time in layers.
I had open cell spray foam installed in the house I'm renovating. I wanted it in the ceiling, and to do that I laid construction paper over the tops of the joists and stapled it down. The insulation contractor sprayed into the that and there were very few places where the pressure from expansion displaced the paper, usually only in areas where I didn't put in enough stapes. Never saw one place where the paper was torn from expansion, but I did see a lot of small nooks and crannies that were nicely filled with the foam.
There are also different formulas for the spray foam and you can see that in the types available at home improvement stores. The formula recommended for use around doors and windows expands but only to the point where it meets an obstruction so it doesn't warp the frames.