The malicious device can just fake breaking the connection and reconnecting. No way for the PC to tell the difference.
Not great, but certainly a lot better than a 100% certainty of fooling the PC.
Plus, 99% of the time the user is not plugging in a HID device, so the "unrecognized input device" dialog can be made ominous enough that users will realize something is very strange about that one USB stick.