I am not a business expert but agree that MS probably has a lot of dead wood and poorly managed employees.
Mass layoffs are one way to deal with this problem and this is what most companies do periodically.
If this is what most companies do, then why is it evidence that Microsoft is poorly managed? (Other than to say, most companies are poorly managed.) Even if they are poorly managed, layoffs may still be the right decision. Say you wake up one day as the CEO of such a poorly managed company. What are you going to do? Change the culture from the inside? Promote radical change among set-in-their-ways engineers and middle managers? Hardly. You're going to stop the bleeding and deal with the problem in the most direct way possible - cut costs.
It seems supremely stupid for a company to suddenly wake up one day and discover that it has an extra xx thousands of employees
Of course that's not what happens. If they laid off each employee the second that they identified that employee as redundant or not needed or underperforming, then all 125,000 employees would feel like their head is always on the chopping block. The chaff builds up over time and eventually you trim it.
Large companies really only know how to do two things: hiring people and firing people. It's much more efficient to axe entire divisions than it is to reassign everyone. Microsoft's responsibility is to its shareholders, not its employees. If you want to work for a company that is loyal to its employees, then work for a private company, or better yet, an employee-owned company. By this point, people should know what they're getting into when they go to work at Microsoft. They get a very competitive salary and the prestige of working at a Fortune 100 company. In return, if they have the misfortune of working in an unsuccessful division, they might be let go. Even then, I'm sure that top performers are reassigned.