If so, (If you were able to test or not), I’d follow these steps:
First, keep a Time Machine backup, if able to:
Back up your Mac with Time Machine - Apple Support
You can even export your mailboxes as another backup option, and which is a good idea, especially if any of your accounts are POP and not IMAP, (You can see this in Mail > Settings > Accounts). As well as if you have custom maillboxes under the On My Mac section in Mail:
Import or export mailboxes in Mail on Mac - Apple Support
Next, disable Mail for all accounts in System Settings > Internet Accounts.
Make sure the Mail app is closed.
Open Finder, while holding the Option key, on the top menu, click Go > Library.
In the Library, open the Mail folder.
Drag the V10 or associated V folder to the Desktop as a copy.
Restart, the. Relaunch the Mail app while holding the Shift key.
Mail should now be empty for the most part.
Next, enable Mail again for your accounts in System Settings > Internet Accounts.
(If you were unable to identify if a specific account caused the issue, I’d enable one account at a time and test before enabling another account).
Otherwise if all is okay, you’re good to go, however if you think you are missing any mailboxes, you can import them from the folder on the Desktop you saved earlier via Mail > File > Import Mailboxes > Apple Mail, then choose the missing mailboxes from one of the alphanumeric folders in the ~/Desktop/Mail/V10 folder.
Otherwise, if all is there, which it usually is, you can just move that folder to the Trash bin.
Hope that helps!
Otherwise, I’d say, if affecting accounts, it could be a preference issue.
If that is the case, (And all works in another user account, etc.), I’d then do the same steps to disable accounts, quit Mail, and this time in the ~/Library, open the Containers folder, move any folder with Mail or com.apple.mail.plist to the Desktop, restart and relaunch the Mail app. (You’ll probably have to set your mail settings again, such as the layout, rules, signatures, etc.).
If that doesn’t fix it, you may need to do other tests, such as in safe mode, or in another user account, which can take time, but reveals a lot as to the possible cause.
Perhaps if the same happens in a new user, and safe mode, and even if this happens with all email accounts, then most likely the operating system needs to be reinstalled:
Start up your Mac in safe mode - Apple Support
Add a user or group on Mac - Apple Support
How to reinstall macOS - Apple Support
Anyhow, hope something here helps!