It’s very common at large companies with different tiers of employees (corporate, warehouse, headquarters) to have different benefits contributions
Unless California has a different state law, I don’t think this has anything to do with contracting. Even at Google’s scale, they could create a separate subsidiary company to hire the employees on different plans if they wanted.
For example, I have a corporation and have explored 401k plan. I can not set up a 401k plan that includes myself, but not other employees, and there are a plethora of requirements around the allowable differences once everyone is in a plan. If I want to give plans to myself and half my employees, the only way to do so is to fire half and bring them back as contractors.
My understanding is it is basically the same for most other benefits (e.g. healthcare)
It does not.
Quick Google search will show pages and pages of results explaining that it is not illegal to give different health care benefits to different employees.
They basically don't. In fact if the company fails fairness testing on the 401k plan, executive contributions to 401k can be clawed back (actually the bar is much lower - "highly compensated employee" above like $130k. So if Google directly employed all of its contractors, it would likely fail fairness testing on the 415 contributions to after-tax 401k, and all the Software Engineers pushing $70k or whatever a year into their 401k would have half of that disallowed by the government).