Ventura docs for M2 Macs in this comment: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd?permalink_comment_id=4555340#gistcomment-4555340
Old Monterey docs in this old revision: https://gist.github.com/henrik242/65d26a7deca30bdb9828e183809690bd/32c410e3a1de73539c76fa13ea5486569c4e0c5d
Solution for Sonoma: https://gist.github.com/sghiassy/a3927405cf4ffe81242f4ecb01c382ac
For anyone looking to update to macOS Sonoma, there are a couple of things to keep in mind:
1.1 In order for this not to happen, you need to block the domains listed below in the router's settings (setup DMZ or whatever your router's equivalent is, look it up how to do it for your own router online)
List of domains to block:
List of services to block/disable:
2.1. Before you unblock the domains from your router(e.g. to get updates for your iPhone) make sure to check your hosts file and add them back or if they are missing as previously mentioned in this thread.
3. (Optional) For even more peace of mind, you can just get Little Snitch or any other firewall and block any inbound and outbund connection to the previously listed services, so if the services become enabled for whatever reason after an update they won't be able to communicate with the MDM servers.