The simplest answer would be that while the company is profitable, the employees they're laying off are not earning their pay on the margin, given their compensation and other hidden costs (i.e. company headcount/managerial bloat).
Easier to justify to employees. Management simply might not feel comfortable culling the herd at a random moment when they don't have the excuse of a stock price drop to lean on. The generous severance supports the idea that they're worried their employees will view employment at Facebook as unstable, or maybe just find it difficult to let people go without feeling bad about it.
Echoing some sentiments said in other answers:
"Successful" tech companies are designed, structurally, for growth at every size. Startups grow to fill a market, large companies grow to expand into new markets. The currency of power internally is headcount — so everyone's pushing for bigger teams, more scope, etc.
For larger companies, hiring is a huge machine that takes time to change course. So, executives are trying to predict the future — what might the economy look like? what businesses will be successful?
When times are good and capital is cheap, incentives aside, this sort of culture might make sense. Google and Amazon have demonstrated that you can keep compounding far longer than anyone imagined, even people who believed in power law outcomes.
High-leveled employees and investors share an incentive: they want the stock price to go up. Sometimes the price goes up because of company growth (alluded to above). But in hard times, lean/efficient companies are valued. There's no reason to run the company break even if you can run it profitably; and no reason to run it merely profitably when you can run it massively profitably.
Meta is an interesting example because they are in an unusual position: they historically had a cash cow (Facebook, Instagram), but it's clear to everyone that it won't last forever. So they're desperately trying to manifest the Metaverse into being their next act. Investors agree: at the recent low, the $META stock was trading around 9x earnings, which is incredibly low for the type of company they are ($GOOG was over twice that).
Lastly, it's fairly safe to say that ~20% of a large tech company is dead weight. Not that they aren't talented or doing useful jobs, but that from the outside, the company could do basically the same without them. This is fractal: companies may be supporting products that were a bad idea, but no one's taken the political hit to cancel it; middle and end-line managers may have a few low performers that are borderline, and they never got around to doing the performance improvement plan → firing HR process.
So there's a few dynamics at play:
My guess is "never letting a good crisis go to waste". It's an excuse for refocus / restructuring.
Also, there are real communication costs associated with huge headcounts in tech. Earning their pay on the margin is not enough.
Also, perhaps (hopefully) the culture shifted from exponential headcount growth...
Hypothesis: they overhired because they were worried about difficulty hiring in the future, and are now laying off people they never actually needed but were holding onto in case they were needed later. Their staffing needs could stay exactly the same, but if they stop being afraid of hiring difficulties they don't need to lock people in ahead of time.
It's hard to estimate the marginal value of an employee. In boom times, it's easy to see that surpluses justify experiments and expansion to find more avenues for future profits. In lean times (and especially just after the shift from boom to lean), those surpluses are less certain in the future, and the avenues for future profits are both less likely and likely to pay less in the near-future.
There is a true shift in the expected value of many projects, and therefore many employees. I think that explains a lot of layoffs or hiring freezes during a downturn.
I think it's ALSO worth acknowledging your thesis - it shifts the balance of power among decision-makers, away from "growth at any cost will eventually pay off" to "stay lean to survive the coming winter".
And also also, it's the "normal" thing to do, and you don't want to look weird to investors. Along with this, it's easily justified to those who will be laid off - it's very hard to fire people without pretty strong cause, so it's perhaps worth it to trim a bunch of workers every decade or two - you'll lose some good people, but you'll lose more low-marginal-productivity employees.
https://www.npr.org/2022/11/14/1136659617/tech-layoffs-amazon-meta-twitter
According to Zuckerburg, it's because the surge of COVID-era internet use caused excessive hires that are now redundant due to people going outside more. Not as many people using Zoom or Facebook leads to less demand for maintenance and less advertising money, which leads to layoffs.
Among any big company's investors there's those who want it to stay lean, and those who want it to expand. When Meta posts poor financial results (even if they have more to do with the state of the economy than whether Meta's business decisions were any good), that shifts more firepower towards those who want to slim things down, and so Meta is forced to make cuts.
Mark Zuckerberg has majority voting rights as a Meta shareholder, so unless meant some way other than literally, this can't be the explanation here.
Consider all the reasons you might have to reduce headcount in an economic downturn:
So consider Meta:
Also laying off staff has enourmous costs. Meta is paying extremely generous packages to laid off employees (16 weeks of pay, plus 2 for every year working at meta, and 6 months health insurance). It also strongly demotivates people who weren't fired and makes it harder to recruit in the future. Finally, since fired employees aren't usually given a chance to handover, it leaves their colleagues scrambling to take over their roles.
My best guess is that actually the layoffs have nothing directly to do with the economic downturn. Among any big company's investors there's those who want it to stay lean, and those who want it to expand. When Meta posts poor financial results (even if they have more to do with the state of the economy than whether Meta's business decisions were any good), that shifts more firepower towards those who want to slim things down, and so Meta is forced to make cuts.