> presumably they keep their best employees
I don't think that's a safe presumption, especially in the case of mass layoffs. Often every team will have to shed people, so if a whole team is made up of high performers they'll still have to get rid of good people. Then you've got the cost cutting nature of laying people off, sometimes the highest paid will be the ones with a target on their back.
The high performers are often on duties that have them directing the future of the company, things like planning to upgrade/rewrite that old legacy system. When it comes to layoffs they'll be let go while poorer performers maintaining the old system will be kept because they're needed for immediate operations.
Companies will layoff anyone not involved with "keeping the light's on", that doesn't correlate with individual performance.