Three possible scenarios against "vendor lockin" in my opinion
- use fetchmail and dovecot as described better by the other posts here
- use imap on your third party and make regular backups using offlineimap (if using linux...). Tools like this should exist for other OSes too
- use imap on your third party. When you are no longer satisfied get yourself a new party, and transfer the whole shebang with imapsync. As long as the mails are accessible via IMAP, youre good to go.
Myself i'm using offlineimap as a systemd-timer in background continously and imapsync last time i switched from my own mailserver to a third party solution.
Both work like a charm.