What the fuck are you talking about? In actual reality it was a product of capitalism. Specifically British imperialist capitalism in China. It took until the mid 80’s (40 years after the Communists came to power) for the British to allow China to have control over the area and it was turned in to a park less than a decade later, clearly indicating that the Communists were in no way interested in continuing the existence of the dystopian walled city.
It’s more accurate to say that the British prevented either themselves (through inaction) or China (by treaty/law) from having any practical control. If you’d bother to read the wiki article OP linked you’d know. China should have had jurisdication, but Britain techincally had (imperialist) jurisdication. The result was a no-man’s land until Britain finally gave up.
EDIT: missed a word