I have never worked with env() myself, but by reading the docs and spec I have a feeling that they are not settable/modifiable by script.
If I understand correctly the Iframe will contain an arbitrary (external) website for testing purposes. I think this will also rule out the following shenanigans because of cross origin restrictions:
fetching the content of the CSS file
replacing env(safe-area-inset-top) et al. with new values
add the new CSS code to the Iframe
removing the old CSS file
Since I’m no expert on this area I’m happy to be corrected.
Sorry, I couldn’t provide a solution to your problem
My question re-formulated: does a method exist to load an iframe with specific env variables, or allow inside page JS / CSS to overwrite env variables ?