Layoffs are rational and are common in downward cycles.
I get the feeling that a lot of the shock and awe here is due to age and a lot of people starting their careers during an extended boom period, particularly in tech which was getting absurd. The last few years in particular were far from rational.
Now the Fed is raising interest rates, housing is cooling, cheap money is no more ... and as a result you get a downward business cycle resulting in layoffs.
I don't see anything new here that hasn't happened over and over again ... but I've been in the industry for decades with multiple companies and sectors.
These companies aren't charities, they aren't meant to retain jobs just because they are profitable, and they definetly aren't your friend. Many of them are publically traded, which at the end of the day are beholden to one and one thing only, the shareholders.