Rework PG restore after DB version migration
The latest upgrade from PG 13 to 16 highlighted issues that could possibly happen to users.
Especially if the init of the new DB with initdb
fails for some reason, or if extensions can't be created, etc, the app crashes, and upon restart doesn't restore the old dump like it should.
Let's try to make this a bit more crash-proof.