These companies laying off people are doing so because they made a mistake to begin with (over hiring). So, yeah, if you make one mistake, you can make another.
And no: not all tech companies have over hired during the pandemic and they are not firing people these days. No one talks about them because that doesn't sell.