Move get/set_env_var compat helpers from compat to env.