If you are using Apple's Mail app in macOS then you can just create mailboxes on the computer and drag email from each inbox etc. to the mailboxes (folders) you have created.
Here is a bit of a peak at (part of) the mess I have...
All the folders after "On My Mac" were created by me and stuff moved into each as I feel suits my needs.
In your case you could create a mailbox with something like "Inbox from domain 1" and go into your present inbox, do command-A to select them all and drag them to the new mailbox (folder). The create another like "sent from domain 1" and go into that sent mailbox and command-A and drag all those to this new sent mailbox. Etc. Repeat for the other 3 domains. Shouldn't take more that 5 or 10 minutes and everything is then saved.
Dave Teece