### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

crash

### Expected behaviour

no crash

### Steps to reproduce

* Compile 79e8247ddb166f9b980f40249b7372a502402a4d
* Type `migratewallet`

### Relevant log output

```
wallet/scriptpubkeyman.cpp:1915: std::optional<MigrationData> wallet::LegacyScriptPubKeyMan::MigrateToDescriptor(): Assertion `IsMine(desc_spk) != ISMINE_NO' failed.
Aborted (core dumped)
```


### How did you obtain Bitcoin Core

Compiled from source

### What version of Bitcoin Core are you using?

current master

### Operating system and version

Linux

### Machine specifications

_No response_
else if (nLoadWalRet == DBErrorsNEED_REWRITE)
        {
            error = strprintf(_("Wal needed to be rewritten restart %s to compe"), PACKAGE_NAME);
            return nullptr;
        } else if (nLoadWalRet == DBErrorsNEED_RESCAN) {
            warnings.push_back(strprintf(_("Error reading %s! Transaction data may be missing or incorrect."
                                           " Rescanning wal."), walFile));
            rescan_required = true;
        } else if (nLoadWalRet == DBErrorsUNKNOWN_DESCRIPTOR) {
            error = strprintf(_("Unrecognized  found. Loading wal %s\n\n"
                                "Th might had been created on a newer version.\n"
                                "Please try running the latest software version.\n"), walFile);
            return nullptr;
        } else if (nLoadWalRet == DBErrorsUNEXPECTED_LEGACY_ENTRY) {
            error = strprintf(_("Unexpected legacy entry in  wal found. Loading wal %s\n\n"
                                "Th might have been tampered with or created with malicious intent.\n"), walFile);
            return nullptr;
        } else {
            error = strprintf(_("Error loading %s"), walFile);
            return nullptr;
        }
    }
    // This wal is in its first run if there are no ScriptPubKeyMans and it isn't blank or no privkeys
    const bool fFirstRun = walInstance->m_spk_managers.empty() &&
                     !walInstance->IsWalFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) &&
                     !walInstance->IsWalFlagSet(WALLET_FLAG_BLANK_WALLET);
    if (fFirstRun)
    {
        // ensure this wal.dat can only be opened by clients supporting HD with chain split and expects no default key
        walInstance->SetMinVersion(FEATURE_LATEST);