When I have not seen any trusted devices, then I have had to click on the "Text" button/link to send me a text code for 2FA.
Here is a post from 2018, so I'm not sure if it is still pertinent:
Mac keeps asking to sign in - Apple Community
Are you using more than one AppleID on this computer?
Try booting into Safe Mode to see if you have the same issue. If Safe Mode doesn't have the issue, then it most likely means you have some third party software installed which is interfering with the normal operation of macOS.
Here is an Apple article that may have some information:
Get a verification code and sign in with two-factor authentication - Apple Support
I only have my Mac configured to use AppleID with Messages & Contacts so I can use Messages on the computer instead of the iPhone since I have trouble typing on the iPhone. Back in 2019/2020 when I was using a spare computer for work, I would constantly have macOS and/or Messages prompt me to authenticate with my AppleID on my Catalina Mac. Unfortunately I don't recall what I thought was triggering the problem at the time, but I had noticed a pattern. It was especially annoying since it would also reset some Messages preferences by using my AppleID as a reference in Messages that I sent instead of my phone number (and also a backup 2FA email address would be enabled). I've been trying to recall more about what was triggering it or if I actually resolved it, but I cannot remember any more details about it.
Unless another contributor chimes in here, you may need to contact Apple Support directly for assistance.