I was at a series B startup that did 15% layoffs during the first pandemic wave. The result: we moved faster, code quality went up, morale increased over time. Some layoffs are driven by necessity, and some are opportunistic ways for companies to retool and mass-fire low performers.
This applies at higher levels of abstractions too. When google did their layoffs, multiple entire unprofitable teams and business units were eliminated. It doesn't matter if "they could pay for it". They had an opportune excuse to remove some ugly looking lines from the balance sheet all at once and they took it.
It's impractical for them to try to differentiate high and low individual performers at that scale. No matter how talented you are, you were contributing to a loss-making part of the company.
Apple seems to have been better at not having useless teams and divisions. Tim Cook is a disciplined guy, so I'm not surprised.