Only the home folder is retained between server restarts, it is the only folder mounted to a persistent storage. The other space is temporary space, any change you make to it will be gone after you restart.
This is very similar to starting a docker container and making changes, and then shutting it down and starting it up. Changes can be retained only outside the docker container, for example if you have mounted some storage to the docker container.
You could try to make your files be stored in the home directory. You can also try making symlinks to the home directory from /opt or something - making anyone working against /opt really work with files in the home directory where they persist. And you can also mount a dedicated storage for the /opt folder or some subfolder in it etc.