How many of those factories are foreign owned anyway. I suspect most are majority owned by the Chinese government, with the "foreign" partner providing the technology and reaping only a share of the profits. Much of the rest goes directly to the PLA. (Peoples Liberation Army). In fact the part of the government that owns the majority stake often is the PLA.
You also didn't address the issue of "slave labor". Many of the factories are staffed by political prisoners. Nobody "volunteered" to work in those. This is less likely to be the case in a weapons facotry of course, too much potential for sabotage or turning the "product" on the "management".
China wants to become the world's biggest economy because that's where the power comes from, so it's highly unlikely they'd shoot themselves in the foot by abandoning capitalism anytime soon. Why work so hard to get rich through capitalism only to then re-adopt communism and become poor and weak once more? They want to get rich and stay rich, so capitalism is the new long-term religion of China now.
In actuality, you have it the opposite of the way it actually is. Today's Third World democracies, dominated by majority-poor populatons, are the ones today who are resisting capitalist reforms and privatization efforts (India, Russia, Indonesia, etc.). It's ironic but while "communist" China is trying to privatize and adopt free-market reforms, the Third World democracies' politicians drag their feet on economic reforms and privatization for fear that their majority-poor populations will vote them out of office.