Indeed. Spray foam comes in a variety of formulations to fit conditions.
Application ( in what little I've seen ) was done before exterior siding went on,
but interior wallboard was installed.
For walls around here, some insulation is better than the all-too-common none.
I've seen spray-fixed cellulose still standing with a few studs after a fire took walls & roof.
The easiest retrofit vapor barrier I've seen on interior surfaces is a special latex paint.
Around here exterior walls need to breathe ( and shed water ) .