so we definitely do support env vars in template includes.
As for when to set the env var, pipeline_configuration_init is the right place, and it looks like you can get to the project name via self.parent.
Here’s where the project is getting set and the pipeline_configuration_init core hook is getting executed (conveniently adjacent to one another ). You can see that the core hook is getting called with parent=self (looks like the snippet got cut off – click through to see that line):
So, I just tested referring to self.parent._project_name in the core hook and it worked.