Religious institutions have a little more freedom in certain areas regarding who they can hire and fire depending on their job duties.
For instance, a preacher for a Baptist church can be required to be Christian as a condition of their employment. But they can’t fire a janitor for religious reasons because their faith has no impact on the work they perform.
For teachers, they probably have a policy regarding public support of the church and its doctrines that was violated when the teacher posted about attending a drag show.
It’s stupid, but it’s legal.
I have similar restrictions at my job in municipal government. I’m not allowed to get involved in local politics or advocate for or against candidates openly. As a public official, I’m always at least somewhat on duty.
Hell, I have to be careful about what I text, because my personal phone is subject to Open Records requests.