This website reports that it’s possible:
On the Mac, it works while filling 2FA fields when a 2FA code appears in the Messages app on your iPhone. A prompt then appears below the 2FA field on the Mac and clicking it automatically fills the field.
Prior to Big Sur, Security Code AutoFill was limited to Safari. However, with Big Sur, Apple has extended the feature to support third-party apps as well.
However, I have never been able to get it to work even though I have SMS forwarding to my Macbook enabled. The article notes
Developers, although, have to explicitly include the feature within their apps if they want to add 2FA AutoFill functionality for users.
If any third party MacOS app would be willing to implement this, you’d think it would be Chrome, but as far as I can tell this has not been done.