"Market expectations" are predictions of the future. Early pandemic, predictions for tech companies were favorable. They were hiring not because of quarterly targets or short-term objectives, but because companies believed they would be able to pull future goals forward. They are now laying off because future predictions are more bleak. With new data, we form new ideas. There are few companies out there saying "we're 100% confident we can grow 100% YoY for the next two years" but not hiring according to that. Their projections of where they will get have changed, and the hiring plan follows suit.
It's really easy to say this with hindsight, and we often forget/don't realize when we're acting based on it. The reality is that unless you (the general you) were shorting Google/DO/Salesforce/whoever in 2021 at their peaks, then it's clear none of us really know what the future hold and are all guessing. If it was so obvious then, there are ways for us to individually profit off of that.
So, being 100% genuine here: if you really believe you have a better opinion about long term value, play in the stock market. Short companies that are underinvesting in growth compared to their competition. Buy the dips. Sell the highs. But my guess is you don't have that level of confidence (I certainly don't!) and that should help explain why, as the person responsible for a >$1B annual budget, you might have to change some decisions you made when new data comes in.
"We need to lay people off now to focus on profitability"
Are they also doing any hiring whatsoever?
If in 6 months Jerome Powell comes out and says "no more rate hikes, expect to taper down from 5% to 3% in the next 12 months", does DigitalOcean (and companies like them) turn around and "go for growth" again and restart the (expensive) hiring process (after having just laid people off not too long ago)?
And what justified these beliefs, to them?
In the end, hiring is a transaction. Google does not have obligations beyond that, and neither do employees toward Google when there is a better transaction or when the terms no longer suit their needs.
Put more clearly: investors __do not want to invest__ in companies that are burning money right now, no matter their cash balance. Responsible, profitable growth is the goal. Your cash backstop is not relevant.