Getting back to this after a long delay, sorry about that!
I neglected the render sandbox that the renderer is running in and how that would cause issues with environment variables. Something much simpler you could do in an Event Plugin is use SetJobEnvironmentKeyValue() instead. That should save some hassle on your end.
Though it has been a while, you may have already tried this!