I'm sure they've always wanted this - but recent events likely made it a glaring necessity in their eyes. When Apple and Google app stores removed Parler it was a big deal, a bigger deal was AWS deplatforming them - a logical step further would be removing the hosted source code. I'm in no way commenting on whether it would be right or wrong, but its not hard to imagine a scenario where company morals begin to come into play here.
I don't think the CCP cares about an obscure American social network. They know they have a dependency on American software & software distribution mechanisms, & have known far longer than Parler has been around.
The obscure American social network is not the interesting bit of information. It's that the infrastructure and delivery corporations decided overnight not to support a customer for not aligning with their values.
This is why China used the GFW to grow Alibaba Cloud, Tencent, WeChat and more that provide more than sufficient infrastructure and delivery, from servers to payment processors, and currently has almost-good-enough alternatives for the silicon down to the foundry level.
That's a good point. They probably want their own Github as much to control it but also so they won't suffer consequences from embargos like when Iran was blocked just recently