I don't know what you mean by Deleting the Envelope Index will cause Mail to "Rebuild" the mailboxes by digging through all of the raw messages stored on your Mac.
You asked about deleting configuration files. The Envelope Index is the database that Mail uses to display and rapidly search for email messages. It doesn't scan through all of the raw text and display that. Mail gathers all of the information from the raw messages and stores it in the Envelope Index database file. It uses that to build the lists of emails. When you select one, it looks up the pointer to the raw message file and grabs it for display.
If that gets wonky, you'll end up with blank messages, incorrect headers for the message, or other weirdness.
I'm not sure that is necessary at this point.
Mailbox > Rebuild causes it to re-index the mailbox you have selected. Deleting the Envelope Index is effectively the same as rebuilding every mailbox.
Deleting the Envelop Index (including -wal and -shm) will force Mail to rebuild the index when you restart Mail (delete it while Mail is not running).
I do have stored messages in "On My Mac" mailboxes. Could I remove them and then reinsert them if Mail was rebuilt?
If you export them to a folder in Finder and then re-import them. I would export each folder individually as it makes it easier to import later on. When you import, it puts the messages in an Imported Messages folder. You then have to move them to your desired folder (which you have re-created).
I think there is an undocumented limit of about 200 messages for each export. It doesn't tell you, it just doesn't export them.
I don't understand how to do this: you can just "reset" your email accounts by signing out of the email accounts in Internet Accounts system preferences (AppleID for iCloud), then add the accounts anew.
For an iCloud account, just select the account, then deselect Mail from the list of iCloud services.
Your ON MY MAC folders will remain, even if they were messages from your iCloud account. You would only need to save them if you erased the ~/Library/Mail folder.
In your screen shot, you do not have your iCloud account selected. You have an AOL Instant Messenger account selected.
If you want to access your POP accounts sometime in the future, don't delete them and don't erase your ~/Library/Mail folder.
~/Library/Containers/com.apple.mail/
Would the Mac OS rebuild this? What would be lost, if anything?
You would lose all of Mail's settings including Favorites, what folders are displayed, etc.
I would only do this as a last resort when nothing else works.