I could be a little wrong, but I don't think the layoffs are due to any feature growth/development (such as building AI into products or anything).
What a lot of these layoffs likely are, if I would hazard to guess, are people in roles where you could effectively google their outcomes. So like a sales team of 10 people has 1-2 salesmen, 1-2 admins, and the rest are cold callers. (being extremely small here) - your cold callers are just trying to generate leads for the sales people. What if you could instead scrape social media/posts/whatever of a target company and instead of cold calling them you have a bit more granular view of their needs/growth strategy from an outside perspective, without having 1-2 people dedicated to it? Now your cold caller team only has to be a couple of people to filter through the better prospects from the scraping, and you minimize dead ends for the sales team?
Or take customer service/t1 tech support. Your general customer service person is going to answer a bunch of bullshit questions that always lead to similar outcomes. So you invest in a bot that does the work so you don't need the initial CS role. How many people is that at a company as large as MS? Or your T1 escalation chain. It's already 100% sourced to india, and they are literally just reading off a triage/call list. That can be handled (and likely T2 escalations) by a simple bot that just goes up a binary answer tree to get to solutions. For most things... this is probably pretty acceptable. So you lay off more people (it's the 2000s; these layoffs are all whites in most cases).
You generally don't lay off positions you need to generate money or positions you need to keep generating money. You layoff the ones that don't generate money and can be easily automated. I would imagine this is the vast bulk of MS layoffs.