I worked at a company that tried to avoid mass layoffs at all costs. Whenever it became obvious that change was necessary, they'd do little cuts here and there, or they'd force people into roles they weren't familiar with (think front-end devs moved to cloud backend dev) to try to salvage people at all costs. They only cut people in small numbers here and there, and always spread out over long periods of time.
It was terrible. People were angry because they were hired for one job, but forced to do completely different work because the original needs had disappeared. People were constantly living in fear because there were micro-layoffs multiple times a month. They weren't called layoffs, though, so they weren't announced. You'd just open Slack to message someone and they'd be deactivated. You always wondered if you were next.
It's not pleasant to do mass layoffs, but if a company has to change it's much better to just rip the band-aid off and restructure all at once.