Skill has nothing to do with layoffs.
Not all roles in these big companies are viewed as equal when it comes to how leadership views the value your team/department/org plays within the companies bigger picture. Be business smart, not just engineering smart and layoffs likely don’t come your way.
Further this with being non-financially illiterate, save money, don’t live beyond your means, treat your stock RSUs as bonus income and life will start to look a lot different.