No, you give them a fat severance and eat the losses. Maybe 6 months + 1 month per year of tenure, something like that. You're break even by the end of the fiscal year, you just gave someone a lifechanging amount of money, and they don't have the crushing morale problems of "the work I do is pointless" and get to collect unemployment in addition to severance.
If you are honest and generous with people, they aren't mad that you made a mistake and let them go. It's companies that try to give 2 weeks + 1 week per year of severance that are making a mistake, not the entire concept of layoffs.
(Without delving into the systemic reasons that layoffs are inevitable of course. If the system was different, they wouldn't have to happen, but we live in this system at the moment.)