Hi!
When a container is being created, the last part is always the cloud-init. That is, LXD starts the container, and when the container takes over, does the startup and when it reaches the cloud-init service, it performs the instructions that that were gived in the LXD profile.
You can know whether the cloud-init instructions have been processed, see How to know when a LXD container has finished starting up – Mi blog lah! (and the comments).
When you setup environment.PULSE_SERVER in the LXD profile, you will notice that this is not added to /etc/environment or somewhere else. So, how does it propagate into a shell in the container?
My old tutorials had a LXD profile that would edit ~/.bashrc to add this variable. This was good enough for lxc exec mycontainer -- sudo --user ubuntu --login, or frankly in any case you get a shell.
But the elegant way is to use environment.PULSE_SERVER, which means that is needs a special way to get the shell.
See Using command aliases in LXD to exec a shell – Mi blog lah! and specifically the last two ways (I use the last way), which manages to get any environment variables from LXD.