If you run macOS without the virtualization.framework, which is only possible on non-ARM mac's, then it will work.
I have Mac running on ESX signed into my Apple account. I haven’t used it too much but it’s on my list of devices on my account.
Even says “VMWare” for device type.
Mine got logged out when I used a publically shared id, and stopped being randomly logged out when I picked a random number.
The ancient random serial numbers are also in a standard format.
> Apple devices manufactured after 2010 generally have 12-character alphanumeric serial numbers, with the first three digits representing the manufacturing location, the following two indicating the year and week of manufacture, the next three digits providing a unique identifier, and the last four digits representing the model number.
Hackintosh users have to do something similar to be able to sign into iCloud.
The serial number doesn't have to be valid (as in existing on a physical machine) to work, though. It just needs to look valid (be generated using the same methodology as real serials). In fact in order to prevent accidentally using a serial tied to a machine owned by somebody else, the recommended procedure is to generate a serial and check its AppleCare status to verify that it's not tied to a real machine, and if it is to regenerate and check until you find one that isn't.
There may be ways to get around this but I don't of any.
Third-party app stores and outright website-based app distribution are coming next year anyway.
It'd be rather similar to the situation with Docker, where Xcode and the simulators would run markedly better on macOS than on other platforms due to fewer layers being necessary. Developing for iOS on Windows or Linux would technically be possible but it wouldn't be very pleasant.