Good point, but I can't help thinking that even under those circumstances, a professor who still taught the material in a competent, appropriate manner would still be OK. After all, you can believe whatever you want to... you just shouldn't be allowed to shove it down your students' throats.
Well, of course in this scenario no one would know you changed your beliefs unless you told them. And if you tell them then by default you would be expressing an opinion not held by the institution. And if you decide to go against what the institution upholds then I think they have a right to fire you. Again, to those just reading we are speaking of religious institutions.