I think this is easily explained.
The one that is working is different to the two that are not. most likely in their state of having been updated or (same thing) in their different use of plugins/theme.
There is a pointer in that log message to the theme that is causing the problem and why.
I doubt if this has anything to do with Virtualmin (why were you “restoring Virtualmin” and how, what were the changes made to Virtualmin from the presumably working system?) Is this a new, clean install? on what (we are missing that important System information) were these “restored” from a backup. why?
The http 500 error is also a rough guide where to look. It typically is the end result of a database error. So is the non-working site attempting to update (reconfigure a table in MariaDB?) → probably, as themes store their status in the Db.
Jave you looked at you .htaccess file ? All I’m thinking is this file contains some php directives that are not valid for the execution mode of php you are using. Try changing the php execution mode to something different. At a guess I would think your old system was using apache mod php and you are now using php-fpm
Than you,
So working ok on Debian 9. but not on Debian 12.
The sites were backed up → can you remember which version of Virtualmin was on the Debian 9 box. Also what version of PHP was running there?
I am assuming Apache on both old and new.
Debian 9 to 12 is quite a big move in itself. I’m not sure I would have made such a leap on a production VS. 12 has some issues when moving from 11 that have been discussed on here (but I don’t think they are relevant here).
WordPress has also gone through many changes in 5 years. I do hope all those updates were applied prior to the backup → 5 years is along time in IT