example of configuring dovecot as a proxy. I am using passwdfile, the same can apply to any other method by setting up users extra fields: https://doc.dovecot.org/configuration_manual/authentication/user_database_extra_fields/
By playing with the configuration files, it would be possible to redirect clients request to the desired imap backend. Sysadmins know how useful proxies are