I'm running into the same issue where Alfred search cannot be invoked via the main hotkey after focusing on most password fields in browsers, browser extensions, and native apps. It's reproducible. Running Monterey 12.1
Thanks for this solution - it does invoke search (with a slight lag time) but unfortunately it suffers from the same problem. Alfred search stops working until I run the app again manually, which so far I've been doing via Spotlight.
Let me know if I can do anything to help you track down the cause.