Why did Medieval kings so often defy the Pope despite an excommunication’s implications for their afterlife?

by gr33ny3

The example which immediately comes to mind is King John, who continued exploiting money from his clergy even after he was excommunicated. In the case of John and other similar princes of this era, why were they so willing to go against a Pope’s orders if they genuinely believed that an excommunication could lead to them going to Hell. Could they have not actually believed in the Catholic church’s power over their souls, or were they simply willing to accept possible damnation for worldly gains?

Deusselkerr

As a follow up question, how do we typically tell if a historical figure was actually religious, or simply pretended to be for propriety/ceremony?