@thomas-hn I'm doing something similar to this with mailcow dockerized (email server) and getmail (also runs under docker).
Effectively, mailcow has an option to poll for email from external accounts. It does this using imap but at fixed intervals. This works well for initially syncing up an account but not for ongoing use unless you're ok with delays.
Getmail is a python script running along side mailcow. It maintains an IMAP IDLE connection to a specified account's INBOX, retrieving any new mail as it arrives. To keep things simple, retrieved email is then either deleted on the remote host, or moved to a specified folder. That is, getmail is dumb in the sense of keeping track of new/existing email. If the account is not empty it gets everything then moves/deletes it.
I use it to sync 6 or 7 accounts from a backup mx server. Seems to be working well.
https://github.com/christianbur/docker_projects/tree/master/getmail
Perhaps this or something similar can be implemented in your use case.
------------------
I initially implemented something similar to Stoiko's solution in #5. However, those redirects ended up at the same server because the domain name was the same. That is, it wasn't following mx record priority but rather delivering to itself.
There is an option to change this behavior (backup mail exchanger?), but doing so would defeat the purpose of having those emails available if/when the primary mx is down.