This is stored in the C++ code, generated by rstan::stanc() which is where those flags are effective. You may expose the model compile info in R and check it.
You may check the generated C++ code or expose the model compile info in rstanarm (edit the source code). But, in general, you do need to set the optimization option in ~/.Rprofile and restart the R session since the package build doesn’t respect the options or environment variables (e.g., when it’s built using R CMD). Adding the option in ~/.Rprofile will apply it globally except for no-profile sessions which is not the default.
I know it’s stored in the C++ code, but thinking of users, it would be nice to show the info a bit more easily than getting hundreds lines of C++ code and search for the string there.
I can also confirm that options(stanc.allow_optimizations = TRUE) works with brms when the backend=rstan.
If you enable the optimization option in ~/.Rprofile and reinstall rstanarm, you’ll most likely get performance improvement too. The compilation may take longer though.