I have been using a rebuild mechanism for containers with attached disk devices and have a tool to manage launching and rebuilding such containers:
https://github.com/melato/lxdops
I have also discussed it here: Lxd-ops: Separating container OS from user data But the project page is probably clearer.
The idea is to avoid using the root filesystem in the container, put all application data in attached disk devices (in places like /var/opt, /opt, /etc/opt, /usr/local/bin, /home, /var/log), and do a bit of repeatable minimal configuration to make your applications work this way. This minimal configuration needs to be done on launch and on every rebuild. For me it is not enough to replace /etc/ and /var/. I consider these to be replaceable too.
For example, for nginx and apache2, my initial repeatable configuration adds configuration files that read application configuration files from /etc/opt/apache2/ or /etc/opt/nginx/, which are in the /etc/opt attached device. So replacing the root filesystem, including /etc, does not lose my web server configuration files. /var/log is on an attached filesystem, so log files are preserved after a rebuild.