Maybe I’m missing something but these USB attacks require interaction with kernel drivers so if you plug in a dock that then presents mysterious storage or HID functions, you’re going to know.
https://support.apple.com/en-bw/guide/mac-help/mchlf779ae93/...
It is probably possible to automate the keystrokes to quickly kill this screen though.