Right now to recover from a backup with an encrypted HD wallet the user must do something like unlock the wallet with a really long time out and manually trigger a rescan,  otherwise they risk missing some keys when auto-topup cannot run.
// Try to downcast to DescriptorScriptPubKeyMan then check if the s match
        DescriptorScriptPubKeyMan* spk_manager = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man_pair.second.get());
        if (spk_manager != nullptr && spk_manager->HasWalletDescriptor(desc)) {
            return spk_manager;
        }
    }
    return nullptr;
}
stdoptional<bool> CWalletIsInternalScriptPubKeyMan(ScriptPubKeyMan* spk_man) const
{
    // Legacy script pubkey man can't be either external or internal
    if (IsLegacy()) {
        return stdnullopt;
    }
    // only active ScriptPubKeyMan can be internal
    if (!GetActiveScriptPubKeyMans().count(spk_man)) {
        return stdnullopt;
    }
    const auto desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man);
    if (!desc_spk_man) {
        throw stdruntime_error(stdstring(__func__) + " unexpected ScriptPubKeyMan type.");
    }
    LOCK(desc_spk_man->cs_desc_man);
    const auto& type = desc_spk_man->GetWalletDescriptor().->GetOutputType();
    assert(type.has_value());
    return GetScriptPubKeyMan(*type, /* internal= sc_spk_man;
}
ScriptPubKeyMan* CWalletAddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const stdstring& label, bool internal)
{
    AssertLockHeld(cs_);