You’re missing a number of critical factors. One of them is that companies have largely abdicated performance management and managing out underperformers, and layoffs are a primary means to get this done. Another issue is that larger companies have incentives problem when headcount justifies manager-track promotions. Layoffs are a way to force them to address dead weight headcount.
You should think harder about what might drive layoffs.