Don’t wait for a layoff, start organizing a union for that juicy ‘represented’ employment status (as opposed to at-will). Unions can’t stop layoffs, but they can minimize the impact, negotiate a higher severance, and provide advanced notice. I highly recommend the good folks at CODE-CWA, they specialize in organizing tech workers
The US has the WARN Act, which requires 60 days’ notice or 60 days’ pay if at least 500 employees or 33% of the workplace are getting laid off (whichever is smaller). It’s a threadbare legal minimum on severance, but there is a minimum.