Too long, didn't read: every email from AppleMail has a corresponding file in the Mail folder. These files can be archived directly. Except for Gmail. Because there is no file Mail Archiver has to use AppleScript for archiving Gmail emails. Which is slower than reading the files directly.
Every email can only be in one mailbox. Gmail wanted to make things better and has labels instead of mailboxes. Every email can have multiple labels. For mailboxes this translates to emails possibly being in multiple mailboxes.
AppleMail email files
The emails from AppleMail are in the folder user/Library/Mail/VX where X is a number that corresponds to the version of macOS. It's V5 for High Sierra. Catalina is V7. Then you have folders with cryptic names, which are the accounts. With AppleScript I can get the name of the accounts. The screenshot shows my usual test account.
Each account has its mailboxes which then contains the emails in a bit of deep hierarchy. Here I opened the "@read" mailbox where I can see the individual emails:
AppleMail and Gmail
Now lets try that for Gmail. I have a mailbox with some old emails:
and here is how it looks like in Finder:
In one word: nothing. There are only email files in the All Mails mailbox. Somehow AppleMail must know which emails to show in which mailbox. The information very likely is in a database that is encrypted.
I can understand the reason for "faking" the emails: if you have multiple copies of emails on a not very large SSD then you waste valuable space.
But with this I have to use AppleScript to access the emails from Gmail in AppleMail.