A free Africa is one that trades with China, that buys goods from China, that doesn't participate in blockades against China, that sells minerals to China, that has markets open to Chinese goods, etc.
If the west can lock down Africa through a combination of terrorism and sewing instability as they've done in the middle east and installing brutal fascist dictatorships as they did in South America back in the 20th century, well, China is going to have a much tougher time of things because then the west can cut them out of a lot of raw materials as well as most markets and it could be the go-signal for the west to really launch the full embargo and lock-down they're itching to throw on China to create the full new cold war situation where they try and choke them out. Because they have Europe under their thumb, their navy can cut them off from markets in the Americas, Russia while a market isn't big enough to form a healthy, thriving isolated economic bloc with China.
Purely from a tactical standpoint if tomorrow an advanced alien communist civilization showed up, handed China a ton of super advanced weapons and tech knowledge for everything they could possibly need then peaced out, it would be the tactically smart thing to immediately send troops and support Africa. However, as that has not and is not likely to happen, China still wants to benefit from the west and their markets and bringing in capital as long as they can. Also they still have reliance on the west for many things.
For example, Xi has recently been stressing food security and growing more food in China, this is because though the US economy would crash and burn if trade were shut down, people in China would be hungry, not necessarily starving but the age of plenty, of great food whatever you want would be over as they import a ton of food from the US and cutting that off would be disastrous to the quality of life of the Chinese people and would require stringent state-led measures, rationing, etc. So pissing the US off too much in addition to being a trap the USSR fell into and sucked too many of its resources into is simply not one that China can bear without more hardship than the party or most people would find ideal.
I do think though the time is coming where China will have to make choices, not if but when to pull the trigger on confronting the west militarily and standing with oppressed peoples against their exploitation. But there are many things left to be done to fortify China for such a confrontation. China is expected to be potentially able to leap-frog the west in tech within the next 6 years in many areas at which point their blockades and "de-risking" become moot and if the food situation is resolved by then with Chinese growers and deals with Russia and neighboring countries, well then they're in a position of strength.