Maybe the fact that the container is privileged has something to do with it. Whenever we change an automation or a script from the UI, then the file is written to as root. Check this post: Improving Docker security - non-root configuration
I also just checked inside the container, and confirmed that the python3 -m homeassistant --config /config
process is running as root within the container.