Hey there!
Is Gmail the only account you have in Mail? Just curious if the same happens in the Mail app, with other account’s mailboxes.
Another good test, (Besides safe mode), is to sign into a new admin account, as Gmail and test.
I’d say if it works fine in the new user, but issue persists in safe boot:
I’d either reset user permissions, or:
I’ve had luck in Catalina and Mojave, which are a little different than previous OS’, with these steps:
Make sure you have a backup.
Even if IMAP accounts I may still export each mailbox as an extra backup, (Can never be too careful).
Quit the Mail app.
Open Finder.
While holding “Option”, click on “Go”.
Then select “Library”, (You can let go of “Option” now).
Open “Containers” and select “com.apple.mail”
Select “File” then “New Folder (With Selection)”, this will just make another backup.
Next in the same ~/Library, open Mail > V7 > Mail Data.
Select all the files beginning with “Envelope Index”, and again, move to the trash, or another location as another backup.
Then open the Mail app while holding the Shift key, you’ll be promoted to import your mail as if it was the first time, depending on the amount, may take a while.
Afterwards, you can test, (Note that you may need to hover the cursor to the right of “On My Mac” mailboxes to select “Show” to show them again.
On a side note though, if the same behavior happens in both a new user and safe boot, (Whether or not how it reacts on other devices). Google, in particular has many settings, (Labels, tags, etc), that affect how it shows up in the OS. I have seen one small Gmail setting change from the web completely change mail behavior on Mac OS despite other accounts working just fine.
I also know that now Google now requires you to allow Mac OS to view your mail, sometimes you need to delete and re-add the account to even be prompted for that. (That might be a good step in of itself). And whether or not you have any local rules set up in Mail Preferences, might make a difference, but to me it sounds most likely like an indexing issue, in which the steps above would typically fix.
Hope it works out!
To reset the permissions:
https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac