I mean, this certainly violates the employment contract of both Facebook and Google. I've seen only one of those, but I can't imagine the other doesn't have a non-compete against working for a competitor while employed (which
is at least potentially enforcable in California).
You might be able to negotiate that away, if you really tried.
But breaching a contract isn't illegal. There's no tax issues, the IRS and the FTB don't care how many employers you have. Without due care, withholding will be off more than normal, but both employers will withhold for employee social security, and assuming combined wages are over the contribution limit, there will be a refund of overcontributions. Having two employers in one year makes it possible to overcontribute to 401k, but that's managable.