DomainSourceRouteMatcher caches the domain route key once per process, so cron writes other domains' resolved paths under the wrong domain
Resolves the active domain where the route collection cache ID is built, instead of registering it once per process on a statically held route provider.
The cache is shared with the core route provider, so an entry written for one domain during a multi-domain process (cron generating a sitemap per domain) was served to visitors of another.
The three existing tests reset the static between domain switches, which is the step that hid the defect. Without the resets they fail on 4.x as it stands, the end-to-end one because the second domain is served the first domain's route.
Entries already cached under the wrong domain are discarded by the cache flush that running database updates performs anyway, so no update hook is needed. Worth a line in the release notes for anyone who deploys the code without running updates.
Reported by sushyl.