If you use Thunderbird and want to store your emails "in an email file format that's most efficient for backup and querying that backup later", have you considered switching from mbox (Thunderbird's default mail format) to maildir (each email stored in its own file)?
https://support.mozilla.org/en-US/kb/maildir-thunderbird
https://wiki.mozilla.org/Thunderbird/Maildir
Note: Thunderbird lacks full support for maildir. This is the reason why I switched from Thunderbird to mu4e (an Emacs-based mail client) years ago. Though, some Thunderbird users say they've been using Thunderbird with maildir for years without issues.