Sharing code makes sense for everybody. It lets them spend a lot less resources on fixing shit if everyone else is also doing that somewhere upstream. With FOSS you can have your cake and eat it too. At some point Google calculated that committing one developer upstream for the Linux kernel can save a company the equivalent of a couple dozen specialist developers downstream in bug prevention and feature alignment across vendors alone.
Unfortunately many companies continue to think about code as if it were potatoes. It doesn’t fucking matter who owns the code, it’s a functional spec. But hey, look at all the trouble we have explaining why standards are good – nevermind opening code.