Most people actually don't work at immensely profitable FAANG companies.
And yet they're so massive that them all doing layoffs at the same time despite that profitability has a huge impact on the labor market of the while industry.
If someone produces less effort than they cost, it's reasonable to fire them even if the organization as a whole is profitable. That's probably not what the FAANG companies did, but layoffs are not unjustifiable for profitable companies.
I invite you to read earnings reports from any of the FAANG companies in the last 5 years. Go ahead, I'll wait.