When the big tech companies have been doing mass layoffs, the vibe amongst the workers and on here has always mostly been: but they're making so much profit!
The reality is that an astute and strategic CEO/board will do layoffs as a last resort in order to steer a company through troubling times ahead. Tesla forecast a large drop in 2024 EV sales, which is now happening. They didn't do the layoffs until their forecast turned out true.