It’s not like the workforce just appeared out of nowhere. They were hired by the same management who is now firing them.
Ultimately society has to choose where it wants to be on the spectrum between difficult to hire and difficult to fire, and easy to hire and easy to fire (workers can also unionize to push things further towards the “difficult” end).
Teams and individual were hired for projects and roles that management doesn't now think will work. Keep everyone on-board indefinitely? Doing... what, exactly?
So many of the large companies today are one trick ponies trying to milk their singular profit center to the nth degree instead of diversifying into new niches.
Meta failed spectacularly in the direction they did try- but ultimately, like Google, even that (VR) was a way to expand their advertising business, rather than truly expand their footprint.
Apple seems the singular Silicon Valley company truly able to find new niches and expand their competencies. I do wish they'd stuck with Jobs original obstinate insistence of not paying dividends- it was a forcing function to keep them actively investing that cash into new ventures.