There's a lot of people at these companies who don't do anything meaningful and are getting paid a boat load. There's people like that in almost every company.
Back from the Yahoo peak days I had multiple people tell me that all they did in a week was fix 1-2 small bugs in a day and didn't do jack shit the rest of the week and got paid handsomely. Probably explains in-part the demise of Yahoo as a tech company.
My point is, layoffs typically target workers who are not needed by the company anymore.
People do layoffs in their personal life too. Your house cleaner or landscaper gets laid off when you decide to stop using their services as you try to do the work yourself and save some money.
This ultra-left stance on layoffs being bad is ridiculous. It's part of the business cycle and economic outlook the companies are facing.