This is a pretty common use case for the better consultants out there.
Should a water company have an in-house pipe factory?
Should a game dev company have in-house hardware fabrication?
Should a food factory have an in-house plastic packaging factory?
These questions don't have a clear answer in my opinion.
When it comes to security, the accountability dynamic between personal investment in outcomes and the inherent detachment as an employee of a third party is a bit different than kitchen work, and significantly more important.
This arrangement works to the benefit of both Google and those responsible for securing the company.
I was involved in the replacement for the third time (we used all the old crap pc's we could dig up from across the company)
And given the high profile espionage that goes on in sv and tech having direct control and vetting of security guards makes sense.
Of course for the more secret squirrel side of the biz we always used different security - ask yourself when Bruce Scheier left BT note who he as very careful to be ltra nice to on the way out.
Most game dev companies just aren't big enough to need enough hardware for vertical integration to make sense. Most water companies aren't big enough for a pipe factory to be economically viable, let alone building their own minerals division, oil rigs, oil refinery and chemical plants.
I suspect that security and running cafeterias do have economies of scale (e.g. a business might only need a drive-by check a few times a night, and so it is more efficient to have one guard drive around different businesses than for each business to hire their own guard), but Google's demands for security and cafeteria services are probably high enough that they gain many of the same benefits of the economy of scale.
Allowing management to focus on core competencies is also important for smaller businesses, but eventually most decision-making is delegated to middle managers or even subsidiary companies, so the top tier of management doesn't have to worry about it. For big companies like Google, it is likely that they have modelled it, and worked out it will cost them less to vertically integrate this function.
Businesses generally have far more efficient control over employees than contractors, so if they are unhappy with something, they can just change it rather than needing to renegotiate a contract.
A company such as Valve is probably on the fence on this. They dominate a small segment of the market, but is not really big enough to do something their competitors can't replicate.