A lot of people seem to imagine layoffs happening (or that they should happen) according to some well-calibrated stack ranking at the company level. But that's not typical at all.
Sure some employees on PIPs or otherwise considered low performance may be cut regardless of role. But more typically projects get cut/defunded (whether in engineering or elsewhere) and those roles are eliminated or cut back. A good performer may have an opportunity to find a job elsewhere in the company but, in my experience, that's pretty hard given that any open slots were probably also closed as part of the layoff and everyone is pretty distracted anyway.
I sometimes wonder if the people who think companies are perfectly optimal have ever worked in a company or large organization.
It reminds me a bit of the argument against massive conspiracies to demonstrate how many people have to perfectly as an organization (leaving no evidence behind) and then have to stay quiet indefinitely. The larger the accused conspiracy, the more likely information is to leak.
Sure some employees on PIPs or otherwise considered low performance may be cut regardless of role. But more typically projects get cut/defunded (whether in engineering or elsewhere) and those roles are eliminated or cut back. A good performer may have an opportunity to find a job elsewhere in the company but, in my experience, that's pretty hard given that any open slots were probably also closed as part of the layoff and everyone is pretty distracted anyway.