This has nothing to do with layoffs. They have plenty of money for salary even after these payouts. The layoffs are intended to reduce costs / increase profit. Google has no desire for employees; they only have employees insofar they are a necessary expense.
Once upon a time it was said by Google leadership the biggest cost Google pays is opportunity costs, chiefly in the form of projects and products they don't pursue.