Microsoft's idea with a state parameter should work, if you do the dispatching to the final target yourself.
Currently you try to register 300 URLs/Domains with Microsoft and have the flow just between AAD and your individual app. But you could change that, and register one "dispatcher" redirect URI that just redirects to the final location.
So instead of having just two parties involved (AAD, your RP) you would have three involved.
As pseudocode it could work like this, which is what Microsoft more or less tells you in the referenced docs:
- Start flow from your RP/App instance server1, but provide a redirect URI of "dispatcher.contoso.com/dispatch" and a state of " + server1".
- Now the auth flow runs its course and AAD redirects/posts the result to "dispatcher.contoso.com/dispatch".
- The dispatcher.contoso.com/dispatch then looks at the state value extracts the server1 and redirects the browser to "myapp.server1.contoso.com".
Maybe the dispatcher is just a load balancer that looks at some cookie scoped to the domain to pick the right target server (e.g. sticky cookies), maybe the dispatcher is some trivial code or rewrite rule. Your call.
I see no reason why this should not work for subdomains, what fails if you try?