Especially when the company culture basically boils down to "The individual employee is worth nothing" and "People should be able to be fired as easily as they are hired", which Amazon seems to be, at least judging by the people I've been close to who worked at Amazon.
These companies already know how to hire temp contractors, which is cheaper and cleaners than layoffs with severance.
The real answer is that they pretended the Covid money fountain wouldn't end.
More to the point, it seems that companies were hiring because other companies were too. They didn't want to miss out on the party. Not an economist, but you see this behavior all the the time in markets.
Then after the euphoria wears off they notice:
1. Ditching a lot of unprofitable segments starts to look attractive. The chance for growth could be pretty slim, especially in a slow market.
2. Some of these people are raking in massive salaries for jobs they could get anyone in to do. It looked to many people like the strategy was to buy up people to keep them off the market... not shocking to see the change in heart, which lead to:
3. All these activities were giving employees quite a bit of leverage, and potentially calling into question any managers that might have had "hold down the fort" roles.
I remember having these conversations last summer. It wasn't 100% clear what was going to happen, but this wouldn't have been surprising; people knew. They did about the housing crash, too. It's popular to act like this was discovered by a lone genius, who goes against the crowd.My dad with no connections and basic financial literacy, with some eyes on real estate, predicted this since around 2000-2004. I remember growing up and hearing about the certain housing crash that was coming that was so obvious anyone could see it. (sure some specific points of failure may not have been obvious, but we knew what was going to happen)
Probably someone calculated something somewhere saying "If we hire 25% more people to take advantage of the increased demand, we'll earn more profits even with layoffs with heavy severances for everyone after X months".