xbox went up in flames with the xbox one, which was around about when microsoft as a whole started to get run by business types that had no idea what they were doing whatsoever. 2013 was when xbox permanently lost the console 'war'
I doubt the war was truly lost on that faithful day in 2013. It was still possible to save, and Phil Spencer even did a decent amount of work trying to reclaim the goodwill of people by pushing for things like backwards compatibility for previous gen Xboxes.
I think the larger problem is just that Xbox doesn't really know what itself is. Sony has the same problem to a lesser extent. None of the current gen consoles have any exclusives of note. Sony have a few, while Microsoft have basically none. That alone gives Sony a big advantage. Meanwhile, in the PS4 days, people would buy one just for Bloodborne, while in the 360 days, they'd buy one just for Halo. Now Halo is on PC, so no longer an exclusive, and while the same goes for Sony, they still retain a bit of a default console status, which helps draw in the couch console crown who aren't interested in the PC. If you want a traditional console experience, you buy a PS5, since there's no real reason to buy the Xbox even if you did care to compare them side by side.