I use mbsync to pull my Gmail messages over IMAP into a local Maildir/. Works fine, though it requires a generated app password if you have two-factor auth set up on Google.
What archive format would you back up to, and what application would you use? I looked at this a few years ago and, if I recall, the choices weren't obvious.
I use cloudpull on Mac, it backups my gmail, google drive, calendar.