Nothing could have been done, because nothing needed to be done.
Is there a recession? Probably. Was valuation and market expectation inflated? Obviously. Did Google overhire? looks like it.
But is that the cause for the firing? Of course not. Last quarter revenue was almost 69.1B, 6.1% Y/Y. That is still an offensive amount of money. Management decided to hurt people because other companies are doing it.
Here's your root cause analysis: management is beholden to fads, not facts. Layoffs don't improve performance (https://www.careerusa.org/resources/career-files/158-resourc...), but the market demands it, and nobody in the c-suite has the long term vision and spine to do what is right, rather than to appease short term fads.