### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

Bitcoin Core behaves unexpectedly or even crashes.

* `getnewaddress "" unknown`: "Error: No unknown addresses available. (code -12)"
* `getrawchangeaddress unknown`: "Error: No unknown addresses available. (code -12)"
* `createmultisig 2 '["03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd", "03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626"]' unknown`: Bitcoin-Qt crashes with Assertion Error: "bitcoin-qt: outputtype.cpp:110: CTxDestination AddAndGetDestinationForScript(FillableSigningProvider&, const CScript&, OutputType): Assertion `false' failed."
* Bitcoin-Qt can be started with `-addresstype=unknown` or `-changetype=unknown` without any error message.

### Expected behaviour

Bitcoin Core tells me something like "Unknown address type 'unknown' (code -5)", as if I used any type that is not `legacy`, `p2sh-segwit`, `bech32`, or `bech32m`.

### Steps to reproduce

Open Bitcoin-Qt Console, create/open a wallet with appropriate settings if necessary, and run the commands above.

Or start it with  `-addresstype=unknown` or` -changetype=unknown`.

### Relevant log output

_No response_

### How did you obtain Bitcoin Core

Compiled from source

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

master@b22c275582cc

### Operating system and version

Debian 12 (Testing)

### Machine specifications

_No response_
{
    switch (type) {
    case OutputType::LEGACY: return PKHash(key);
    case OutputType::P2SH_SEGWIT:
    case OutputType::BECH32: {
        if (!key.IsCompressed()) return PKHash(key);
        CTxDestination witdest = WitnessV0KeyHash(key);
        CScript witprog = GetScriptForDestination(witdest);
        if (type == OutputType::P2SH_SEGWIT) {
            return ScriptHash(witprog);
        } else {
            return witdest;
        }
    }
    case OutputType::BECH32M:
    case OutputType::UNKNOWN: {} 
    } 
    assert(false);
}
std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key)