And having worked on Google OSS projects, the 'unpaid labor' aspect often doesn't materialize. Looking at GWT , J2CL, Closure Compiler for example, 99% of all commits are from Googlers, very few outside contributions, despite for example, a peak of 150k MAUs for GWT in its heyday.
Google has 10s of thousands of OSS projects, only a small fraction of them are related to any kind of strategy. Most are people scratching an itch and throwing a codebomb over the wall onto GH.
If Google didn't think 20% projects provided value in terms of employee satisfaction and retention, or didn't find some value in the ability to potentially build on some of that random unplanned R&D if someone struck gold, Google wouldn't do it.
It's possible to have altruistic line employees, but corporations are always acting on cost/benefit. That benefit just doesn't always manifest directly into cash. Employee retention, good PR, etc. are all benefits that can be to some degree valued and measured.
Corporations do not have 100% visibility into what their employees are doing in totality and they often don't write any rules for or against something until after an employee does something so bad it creates negative PR.
There's no employee handbook rule that tells me I can comment on HackerNews, or tells me that I can't (well, I hope not). So until I get a call from Google HR telling me I did something bad on HN, I do it.
I don't think this is Google specific, I don't think the vast majority of employees in the tech sector obtain permission for both after hours contributions they make on the internet, or even stuff they do while at work, even though most companies have a policy not to use work computers for personal things.
People just don't compartmentalize their lives like that. Like say you're at the office, you're browsing some GitHub repo on a project completely unrelated to your company, and you notice an easy to fix bug, and send in a PR on your work desktop while at the office. Is your company allowing you to do this explicitly, or do they just not care, as long as you're being responsible and not spending all day at the office working on non-work stuff and not deliverables.
The COVID era brings this even more into focus, with everyone working from home now, really, how many people are doing other work during office hours?
You're trying too hard to attribute master planning to management, when the truth is, most of these tech companies are more chaotic and autonomous internally then most people realize.
Let's say you're the maintainer of the `ls` command. Some Facebook employee comes along and fixes a bug, out of the goodness of his heart. You're going to think, wow, Facebook is helping me, now I trust Facebook more.
Problem is incentives. If Facebook gets large enough, its employees who are trying to stake a claim in open source might not be thinking about how that ties into the company as a whole, if leadership isn't rewarding it.
When a company open sources something, you're right, they "see the value of open source". They know it will enable collaboration, essentially unpaid labor on their project, community and interest, and while others can use it, it places them at the center in a driving power position over the technology and gives them the ability to set the standard.
Open sourcing is good business. And that's before we talk about the marketing value of claiming it's altruistic and selling that idea to everyone else. Once you start taking advantage of people's naivety to promote your company and your brand, you're really cooking with gas.
People need to stop believing in corporations, because corporations are built for the purpose of making money. You can trust them insofar as you understand that goal and understand them to move in accordance with it.