Yes, MS need Xbox, the revenue streams they help established far outpace any loss taken on hardware. There's a reason MS juggled with the idea of offering the original Xbox for free.
If MS were to shelve Xbox as hardware, this would mean automatically writing off Live Gold revenue which by itself should far outpace those early losses on hardware.
Gamepass subscription count is also still very tied to the amount of Xbox MS is able to sell so they would have to expect a huge contraction there as well.
The revenue from games will also see a similar contraction.
The idea that the market is not big enough for 3 players is also wrong. MS 2021 gaming revenue was north of $16B and was higher than Nintendo's and about 2/3 that of Sony's. No way MS intentionally shrinks this to save pennies on the dollar by stopping Xbox production.