Fixes a regression from BDB wallets, where BDB generated a unique id for us.
This is needed for #19463, automatic backup reminders, and who knows what else in the future.
Ideally, we should probably also check if another copy of a wallet has already been loaded and warn the user, but that can be a follow-up PR.