But Rails was a very early Github user, and the big Rails usage upswing coincided with that and helped drive it. I was a Python and PHP dev at the time, and that other stuff mostly predated Github and was scattered across all kinds of places. Whereas Rails and Github both kicked off about the same time, and practically no Rails devs or libraries used anything else.
It was that fast growth and hype combined with the network effects of Github that drove git usage rather than what Linux used. The Linux contribution workflow was also pretty alien to Github focused webdevs.
That's how Sourceforge rose to become so dominant it appeared unstoppable, and how Docker became immensely popular so quickly.
Bitbucket also had free Mercurial hosting in 2009. I think it was 1 private repo in the free plan and it was later expanded to unlimited free repos with max 5 users around 2011.
So Linux was always going to be git; and I think things flowed from there.
But those are big company problems and I suspect the caveats, tradeoffs and solutions matter a lot less for the 99 % of other VCS users.
There wasn't a similar offering for Mercurial, in part I think because of the fundamentally different way Git and Mercurial treated (treats?) branches. In Mercurial branches were permanent, so a PR-like flow would leave a lot of stale branches around.
Mercurial also didn't support rewriting history as a core philosophical choice.
It was introduced via a plugin but that meant each dev had to enable it to use it. AFAIK it has been moved into the core, but I think too late.
At least as a primarily Mercurial user at the time, I feel Git didn't really outcompete Mercurial until Github and PRs came along. It just allowed for much smoother cooperation.