They don’t have to give Sony or Nintendo a 30% cut on anything sold on Xbox.
The question is if it’s worth it for them. They have to design, manufacture and support that hardware, which is sold at low or maybe even negative margin. They get a percentage from 3rd party sales but with their low sales numbers it may not be worth the effort.
There is also the fact that Microsoft’s core business is software, not hardware. Even if the hardware business makes a small profit there is also a cost associated with a lack of focus in a company.
For example, AWS is super popular even though it would be a lot cheaper for a lot of companies to run their services on their own hardware. They simply don’t want to have to deal with all that because it’s not their core business. At heart, Microsoft is still a software company, it makes sense for them to focus on the software side of the game business.