Well, each domain would just have an DNS TXT Entry Pointing to "mailconf=https://uri.to.app/dnsdomain.tld" to make it possible.
For clarification an example with dig
# dig +short TXT domainA.tld
"v=spf1 mx -all"
"mailconf=https://ac.my.app/mail/domainA.tld/config.xml"
# dig +short TXT domainB.tld
"v=spf1 mx -all"
"mailconf=https://ac.my.app/mail/domainB.tld/config.xml"
EDIT:
And internally it should query all those SRV-Entries on "domainA|B|X.tld" and generate a config with the respective DNS-Priorities. So basically as default something like: incomingserver imap+ssl, outgoingserver submission+tls if you use that template from above.
Nothing really test so far! Just a thought of how this could be done without all those other "A" subdomains (autoconfig|autodiscover.domain.tld) and no extra configuration needed at company-domain.tld.
And after a bit of searching i at least found a few references. But not exactly what i was thinking about.
https://rseichter.github.io/automx2/
https://github.com/Monogramm/autodiscover-email-settings
cheers!