Git is both free AND viral. It's viral because if you want to use someone else's code, you have to use their source control system. Linux using git is a big deal in that respect (and yes I realize the kernel used BitKeeper :) ).
Also, Github as company and git the open source project are pretty complementary. It's hard to house both entities under the same roof, and you need that for ecosystem to succeed. Github is basically a UI/app company, and git is systems plumbing.
It's analogous to some PaaS companies wanting to make their own web framework. No actually that's a huge amount of work and you underestimated it. For all its faults, rewriting Rails is not something anyone can do. Heroku ended up being one of the early success stories because they just took your rails app and ran it.
Likewise everyone thinks they can rewrite Github, but that's pretty hard. It's at least 10x more work than you think, and you can get it wrong. If a tool isn't open source, there's much less incentive for a company like Github to come around and "popularize" it.
It seems like it's very hard to make money in developer tools in general, because so much is open source. And honestly they should be -- I would be a hypocrite if I said I didn't choose tools because they are open source. I guess Github and Atlassian are the outliers.
Anyway, my overall point is that I wouldn't necessarily chalk it up to marketing :) I do think open source got much bigger in the last decade, and it's hard for me to imagine that it wouldn't be built around an open source VCS.