In your User's Library/Mail folder, do you see other folders named V2, V3, V4?
I suspect we might need to do a complete reset of your Mail folder.
Quit Mail.
In your User's Library:
1. Rename the Mail folder to MailXXX
2. In Containers, delete com.apple.mail
In System Preferences > Internet Accounts
Uncheck Mail for each account.
Restart your Mac.
System Preferences > Internet Accounts, check Mail for only one IMAP account. We can add other accounts once we get your "On My Mac" data imported.
Open Mail.
Look in your User's Library/Mail folder to see if it setup up with new folders.
You should see two alphanumeric folders. One will have the Outbox. This is the "On My Mac" folder. The other would be your IMAP account you added.
In Mail do you see "On My Mac" in the folder list?
If yes, let's import your "On My Mac" folders. We have two options.
1) Use Time Machine
2) Select to import from the Mailxxx folder
Let me know which option then I'll give you specific instructions to import.