Honestly though, in my experience macOS especially has a habit of presenting legitimate password dialogs completely out of the blue. It clearly trains users to enter their password into random dialogs that appear at random times.
This is something that hasn't been fixed despite years of complaints from the security community for exactly this reason.
It's especially annoying as touchid provides a standard authentication mechanism on macOS, that doesn't provide reusable credentials to anything.