Tell programmatically if nextcloud's database has been created

I’m looking to set up nextcloud dev environments and backup/restore setups in docker with a specific database. I’m having trouble because the contents of config.php seem to be generated on installation. What I’d like is to be able to set things like the instanceID, password salt, and secret - such that they match known values in a specific database dump. I’d use occ config:system:set but it appears that doesn’t work unless installed is set to true in config.php.

Is there a better way to do this? Or to introspect the database for those values when they’re already set, or set many other values in the installer itself (including “skip creating the database”)? It feels like the installer could stand to be two steps - one database, one config file generation.