I wrote a comment on some other thread but there's just a lot of wrong place/wrong time at an individual level. If a company is doing a substantial layoff there just isn't the time, energy, or resources to train and fit people who may be generically "better" at some level into roles that already have people presumably doing adequate jobs filling them.
People are not fungible. Someone can be in a role where they're really valuable. But the company evolves and roles evolve and the needs are different. Sure, they might be able to excel in a new role eventually--but maybe it's not optimal to try to make them fit especially at a senior level.