Can't remember the source, but the Vatican basically told Galileo that they were pretty convinced of heliocentrism, but if he could please stop shooting his mouth off until they got a transition plan in place, that'd be great.
He didn't, so they put him on lifetime house arrest to try to mitigate the damage he could do.
So he didn't get heresy'd for opposing the Church's position, but for undermining it's ability to assert influence and control.
The Church has always been a community of individuals who publicly confess the same beliefs, while privately holding on to their own motivations.
Now, replace "the church" with any centralized apparatus of power and you've described government.
The cool Pope we have now is rolling back tons of rules because it's necessary for the survival of the institution, not because he necessarily thinks they're just. His opinion doesn't matter, only God's.
High switching costs that Galileo couldn't fathom. A stereotypical head in the clouds scientist.
History is often much more complicated than suits us.