In China, the seventeenth century was a time of remarkable tolerance, individualism, and open-minded intellectual inquiry. Li Yu, for example, has been called "China's first professional writer," meaning someone who intentionally made "writing a profit-making business venture." [...] In his writing, he expressed some curiously modern-sounding opinions, such as protofeminist views about the equality of women with men. In his fiction, he portrayed thieves, beggars, prostitutes, and homosexuals sympathetically, as characters to be judged by their behavior as human beings rather than as stereotypical moral categories automatically to be condemned.
Despite the appearance of prosperity, moreover, the Ming government itself was bankrupt and disintegrating by midcentury. The Manchu conquest of China that began in 1644 would usher in a more conservative reaction, and the open-minded tolerance that gave Li Yu's seventeenth-century fiction such a surprisingly modern flavor would be banned as immoral in the eighteenth century. Manchu conquerors took China in other directions after 1644.
Holcombe, Charles. A History of East Asia: From the Origins to the Twenty-First Century. Cambridge: Cambridge University Press, 2017, 172-73.
The Manchu conquerors established the Qing Dynasty and took China in a more closed direction. Their closing of Chinese society was similarly born of a fear of outside threats:
Manchu rule in China was never entirely secure, and the Qing emperors were always suspicious and fearful of rebellion. Partly for this reason, there were more literary inquisitions and books banned by the Qing Dynasty than by any other dynasty in Chinese history.
Holcombe, Charles. A History of East Asia: From the Origins of Civilization to the Twenty-First Century. Cambridge: Cambridge University Press, 2017, 178.
This pattern - that of an open society closing itself in response to outside threats - is a pattern I've noticed frequently throughout history. The most recent example, of course, is the United States of America. I'd be interested in reading more about the relationship, if any, between a robust military and an open, liberal, and flourishing domestic society.