This closed system based on orthodoxy was difficult for modern reformers to challenge, or disentangle. It was not enough to topple a particular imperial regime. To stage a real revolution in the name of democracy, which was attempted in the early decades of the 20th century, Chinese reformers felt it was necessary to sweep away the orthodoxy along with the sacred rulers.

That was the main point of the so-called May Fourth Movement of 1919, when students and intellectuals marched through the streets of Beijing under the banners “Mr. Science” and “Mr. Democracy.” Confucianism, the ideology that had held Chinese culture and politics together for thousands of years, had to go. Science became for some Chinese thinkers a new kind of dogma, something that explained everything.

Many Chinese intellectuals of the May Fourth generation were attracted to Marxism for that very reason. It filled the post-Confucian vacuum with an alternative, modern political and scientific orthodoxy with a strong moral component. Liu Shaoqi, one of the early Communist leaders (who was later purged and left to rot in prison during the Cultural Revolution), wrote in 1939 a tract titled “How to Be a Good Communist.” His description of the ideal revolutionary, with its stress on “self-cultivation,” sounded remarkably Confucian.

Even after the founding of the People’s Republic in 1949, the separation of church and state did not happen. Mao behaved like a divine emperor whose thoughts had to be learned by rote and revered like a classic Confucian text. Disrespecting or even just ignoring Mao’s “Little Red Book” in the 1960s was treated as a form of blasphemy, for which a person could be sent for re-education in a gulag — that is, if he or she had not been already executed.

After Mao died, and especially after Deng’s capitalist reforms, Maoism and Marxism began to lose their potency. Party members paid lip service to the party orthodoxy, and children were still taught it at school, but nationalism, and even bits of warmed-over Confucianism, began to replace the old Communist dogma. This, too, created what some Chinese and experts describe as a “spiritual vacuum.”

One way of filling the void has been conversion to Christianity, or joining spiritual groups like the Falun Gong, which party leaders view with great dismay. The reason the government tries so hard to crush religious organizations that operate independently from party control is precisely because dogmas that compete with the state orthodoxy are by definition subversive.

President Xi Jinping is very aware of this problem. That is why he is trying to tighten the party’s grip on ideology, as well as revive Maoist thought, while cracking down on dissident thinking in universities, mass media and online. His personality cult, stressing firm paternal leadership, as well as the authority of his philosophic thoughts, is widely seen as a way to reinstate the Communist variety of imperial rule after years of government by a succession of bland technocrats.