Windows/Android are different because the operating system itself is the product. People don't necessarily buy a Google phone or a Microsoft desktop, but they can still buy and run the operating system separately from the physical product.
The question is: if Apple should be forced to open up the iPhone ecosystem, why shouldn't Microsoft/Sony/Nintendo be forced to open up their systems for third party stores? Why are they allowed to take a mandatory cut from anyone that wants to publish on their platform, but Apple is not? To me it seems like a double standard if only Apple is forced to open up, but Microsoft/Sony/Nintendo are not.
Perhaps all hardware that is sold should be open and customisable, and I should be able to install a fresh OS on any piece of hardware I buy. That makes sense to me, but then that doesn't actually solve the problem at all. People will still buy an iPhone and use iOS, so now the OS itself needs to be open in some way. How do you write any of this in law at all?