Sometimes my Windows 10 is stuck in this state but the "ghost input" only happens in places like menu start, new native Windows settings UI or win+shift+s screenshot overlay. Does not happen in any other apps, on-screen-keyboard does not see it.
I suspected AHK, JoyToKey or sth but killing them does not help, disconnecting keyboards, restarting HID devices, nothing helps.