I don't think this is actually true:
1. The Google codebase is on the order of billions of lines of code, not millions.
2. It's basically all written in house, from the threading libraries and core standard libraries up. The parts that are open source (e.g. Linux, OpenJDK) are very small compared to the code they've written themselves.
ChromeOS and Android are open source, but they aren't even close to being the bulk of their codebase.
If Linux had never existed they'd have found some alternative, probably either a bulk licensing deal with a proprietary UNIX vendor or they'd have used Windows as the closest cheap Intel based alternative. Then they'd have put funding into developing their own in-house serving OS a lot earlier.
Source: I worked there.
> Chrome is open source because webkit was open source because Apple forked KHTML from the KDE project.
Chrome is open source for strategic reasons and because the executives in charge wanted it to be. There's no particular reason it has to be open. Safari and Edge aren't.