/Library/Preferences/com.apple.keyboardtype.plist and relying on the keyboard type detection wizard repeatedly did not work for me for my external german keyboard (having also an internal german keyboard).
But editing the file
/Library/Preferences/com.apple.keyboardtype.plist manually worked!
This is what I did:
sudo plutil -convert xml1 /Library/Preferences/com.apple.keyboardtype.plist
/Library/Preferences/com.apple.keyboardtype.plist and change type 43 to 41 (or the other way round, depending on what you have) for all the keyboards (or just for the relevant one, but I was not able to figure out which one to change so I changed them all).
(Converting back to binary is not necessary, empirically.)
sudo plutil -convert binary1 /Library/Preferences/com.apple.keyboardtype.plist
Reboot. Now the < and the ^ keys should be swapped.
Update 2023-08-06: This issue is still present with macOS Ventura 13.5. Pressing the "other" key in "Change Keyboard type ..." does not fix this, but the steps mentioned above do. Setting both keyboards to type 41 fixed the swapped keys for me. But the real cause of this swap is still a mystery. Now the key behaviour in applications is correct, but the keys are swapped in the the "Keyboard Viewer". When pressing the keys the "other" key gets hilted in the Keyboard Viewer. Before applying the fix, then the keys were swapped for applications, the correct keys would hilite in Keyboard Viewer. So the fix above fixes the problem on the wrong level.