What you're leaving out is that Amazon's net sales literally doubled between 2019 and 2021, from $280MM to $470MM. The doubling of headcount over that period was perfectly rational and in-line with its business model.
There was definitely irrational exuberance in hiring during 2021-2022. But Amazon's exuberance was far more rational than most of tech. Ironically, Amazon both hired far more than everyone else and also over-hired less than everyone else. Unlike all of the other FAANG++ companies, Amazon is and always has been a low margin and labor intensive business.