I don't think they thought it was permanent as much as no one really knew when it would stop. They had to make a choice whether to hire enough to sustain the current growth rates or scale back growth in which case competitors might be able to capture that market share. No one had a crystal ball regarding when exactly the growth would stop and what the post-growth period would look like, so from that perspective using all available evidence, the play was to capture market share and worry about the future when it happens.
It's a reasonable strategy, the risk being their cost structure gets unbalanced and they might have to lay off people. Contrary to what people here seem to think, laying off people isn't the end of the world, and many of these companies are very comfortable doing it once their growth calculus changes. It was a calculated risk and if we are being honest, it paid off very well for most of the companies which are currently doing layoffs. In many cases the alternative would be to forfeit growth just to potentially save jobs down the line - but what would that look like for companies like Amazon? I don't know if people remember but when the pandemic hit Amazon was scrambling to meet the demands of customers and prime shipping times shot up from 1 day delivery to sometimes more than a week. Those situations would give competitors like WalMart an opening to capitalize on taking market share.
At the end of the day, no one had a crystal ball, and while companies probably shouldn't have assumed whatever growth rates of the quarter were permanent, to ignore the growth and not hire in that environment carried it's own risks. And besides, are the current growth rates permanent with all the macro-economic factors at play? Of course not, most likely the economy will pick up at some point, but companies don't know when exactly that will be, so the prudent thing is to prioritize their workforce on high priority revenue generating products and balance their cost structure around the current economic realities.