It's the jump from Windows 8.1 to 10 imo. That was when their strategy shifted from Windows being a sold as a product in-itself towards being used as a vessel to push people towards other, more profitable Microsoft services.
In the modern age of PCs, it's just not profitable to sell an operating system as an end product anymore because consumers expect the OS to be available free of charge, like it is on Apple products and Android devices, so the only people actually paying for Windows are OEMs who pay like $5/key, which isn't enough to sustain a profitable OS without bundling a bunch of third party shitware, steering you towards paid Microsoft services like OneDrive/Office 365, and selling all your data
To be fair, in both your examples(macOS, Android) the cost of the OS is borne by the cost of the device, same as if you got an OEM installed windows device from a retailer. That’s not a huge point of difference
And they use the fact that they are the default or almost a defacto monopoly. Why advertise your product when people buy it anyway? Why make it good when a bad product makes more money? Of cause there are memes like "the best advertisement for linux is windows 10" and while it might be the best advertisement, most people stay with what they have or are even forced to use it at work (like me).