The Great Firewall and Social Credit system are both run by the government and definitely penalize this behavior.
Of course there's no law explicitly saying "you can't talk about Tiananmen Square" because that law would be talking about Tiananmen Square which is the opposite of what they want.
But people don't talk about it. It's enforced socially. That's my point. You don't talk about Tiananmen Square, you don't gawk at Falun Gong protesters, etc. Even many Chinese expats act like this. It's just something people know not to do because they don't want to be seen as a bad person and lose friends, jobs, and so on.
That happens completely outside the government's influence.