Yes I think it is depending on your storage format (mdbox only?). I am running "doveadm purge -u" every two months. If I would make a new server I would also use the LAYOUT=index this does not give you issues with mailbox names, however there were some other issues, but I think new versions of dovecot are ok.
So the idea is to set up a classic dsync replication
You should know that the replication feature will be removed from dovecot community edition without replacement (search the mailinglist archive for details).
and to somehow make the slave only expunge the mails manually using "doveadm purge -u"?
Purge is usually used in combination with mdbox storage format. With IMAP mails can be deleted (marked as deleted, often not shown anymore in mail user agents) and expunged (removed from server). With mdbox the IMAP expunge command does not remove the mail from storage and it cannot be restored via IMAP. The doveadm-purge command reorganizes mdbox storage files to ultimately remove mails from disk afterwards (e.g. using cron).
https://doc.dovecot.org/2.3/admin_manual/mailbox_formats/dbox/#accessing-exp...
In this case I believe I could connect to the slave via imap and restore the missing mails (which might be marked for deletion but still accessible) using my mua?
No.
The only thing that comes close to what you want and will be available in the future is this:
https://doc.dovecot.org/main/core/man/doveadm-backup.1.html See the three modes of operation (backup / sync / sync -1). You would have to write your own scripts to cobble up a solution.
IIRC dovecot once had an abox storage format for archival purpose, which was not part of the community edition though.
An email archive like mailpiler.org might be a better solution to your problem (no recommendation).
Best regards, Gerald