I know many many people who went the extra mile for their company (doing more work than expected).
Is it healthy? No. Is it needed? Not always/necessarily. But a company that's laying off members to save costs should likely try to retain those that do go the extra mile.
Also, I mean you can argue all you want that those people aren't productive but in my experience that's just not true. People who live and breathe the company tend to care a whole lot about quality and thinking through user experience. The typical "it's just a job, I can quit any time and find something better" folks just don't stick around long enough to suffer from their decision or care about the company's image / their coworkers.
I mean I've been there. A bunch of folks get hired because they were at Google or Meta before and they must know their stuff, and get elevated to somewhat high positions, but they never deliver on their promise and I cannot say they were particularly productive and they generally also do their "I only work as much as I need" or "Sorry I won't join this one time meeting that needs to happen at odd hours to accommodate time zone issues, it's 30 mins past my end of day" routine. Then after a year or so they leave for greener pastures, probably getting paid more.
Again, I think for a company where it's the norm that people protect their time it might not matter and I'm not saying it's an issue. But if you take a company full of heavily invested employees that see it as their family, and you add, simply because there's a bubble, equal the amount of people who just see it as another job and the company tanks in an economic downturn, retaining more of the latter portion (at all cost) does not seem wise.
The people who don't see the company that way / care are still likely to leave the sinking ship soon, but the damage to the laid off as well as remaining loyal employees has already been done.
And no, if companies were able to accurately identify low performers they could have dealt with them before. I've seen many good folks lose their jobs in the last few months and folks who never released a single thing or provide other tangible output (design docs) be retained.