macOS detected wrong keyboard layout (additional comment)
Even when selecting the correct keyboard type in "KeyboardSetupAssistent.app" (in this case ISO), sometimes the keyboard is not recognised properly. e.g. the key immediately to the right of the left "SHIFT" key and the key immediately to the left of the "1" in the upper row, are swapped in function.
It might not be the fault of macOS. It might be caused by a KVM. Many KVMs have a "Keyboard emulator" option, and it is possible to set the keyboard type (ISO, ANSI, JIS) in the KVM.
As an example, if the KVM is set to ANSI, macOS KeyboardSetupAssistant to ISO, and the System preferences to a "German Standard" keyboard layout (input source), those aforementioned keys will be swapped in function and the Keyboard viewer will show an ANSI keyboard (Long enter/return key) with German legend.
When correcting the keyboard type in the KVM, macOS keyboard viewer will correctly show a German Keyboard (180° "L" enter/return key), with German legend.
So in this case macOS is not the culprit.
The thread about this issue is locked, so I could not add this information there.