a justifiable reason to imprison and execute them
Well, that is certainly a...plot twist.
CK2 is not wrong that excommunication could and did function as a political weapon in the later Middle Ages. But excommunication was not the same thing as outlawry. Essentially, it meant ex-community-ation: being cast out from the Church community. Church community, not human society.
For example, Giacomo Colonna was excommunicated in 1327, and spent that year and the next (a) ruling Rome (the pope was in Avignon), (b) kidnapping the pope, (c) supporting a different pope, and (d) crowning a Holy Roman Emperor. At one point papal forced ransacked some of his family property, but then again he'd had his own forces kidnap the pope, so even-stevens here.
Rather than arrest and execution, excommunication generally involved inability to receive the sacraments, exclusion from general prayers for people's souls (including after death), and burial in unconsecrated ground. As a punishment, it was first of all theological and spiritual, putting the excommunicant's soul in grave danger of damnation. But excommunication was not supposed to be an end. It was a threat and then an act meant to motivate the person to do what they needed to return to communion with the Church.
For a society like the medieval west where Christianity set the rules and utterly dominated culture (whatever people's individual commitment to the beliefs themselves), excommunication was also a punishment by way of social stigma. The vast majority of excommunications were just things like regular lay people who had failed to go to confession in preparation for receiving the Eucharist on Easter, or who had gotten involved with others who were already excommunicated.
Finally, there was often an additional cost for rulers or other leaders (like bishops or abbots/abbesses): interdict. This was kind of like an excommunication for an entire geographic region, monastery, or branch of a monastic order--a ban on receiving the sacraments or singing the liturgy due to supporting the excommunicated leader.
The small-scale but famous example here is 12th-century abbess/theologian/author/prophet/visionary/composer/what-have-you Hildegard of Bingen. One of the last controversies she embroiled herself and her convents in occurred when she insisted on burying in the convent cemetery--consecrated ground--a man who died excommunicant. She asserted that she had had a vision in the Living Light that he was in fact in heaven; the Church initially disagreed. With her convents denied the sacraments, but more importantly to her the liturgy (daily prayers), she wrote a passionate defense of the importance of the liturgy that scholars have called the first "theology of music."
But that example shows something else important: excommunication wasn't just a thing in and of itself; it was a result. Even if the reason was a pretense, it was still a legal punishment that needed some kind f legal reason. While there were plenty of crimes that applied to clergy in particular, the Big Ones--especially wielded as political weapons against secular laity--were heresy and the nebulous "disobeying ecclesiastical authority."
And this is, I think, where CK2 has had its game of Historical Telephone cross some wires. I suspect (not being one of the designers) that they're thinking of Martin Luther after the Diet of Worms. Yes, he was excommunicant. Yes, Duke Frederick the Wise staged his kidnapping and holed him up at a castle in Eisenach to protect him from arrest and execution.
But it wasn't because of the excommunication that Luther risked being burned at the stake. It was because he'd be charged with heresy, and--as already established--he had no interest in recanting his "heretical" (in the eyes of the Church) beliefs. But even so, it's important to keep in mind, heresy would be an ecclesiastical charge; it wouldn't be open to the average CK2 PC to declare independently. (Or...whatever you call your country base in Paradox games).
A more typical scenario for a Church member (Luther being an Augustinian monk and priest) was Lothar of Hochstaden at the end of the 12th century. Accused of a role in murdering a duke who was allied with the pope (in one of a hundred thousand pope-Empire medieval conflicts), Church canon and provost Lothar found himself excommunicated and with his ecclesiastical positions--and income--seized. His response? To take up and travel right to Rome, to present his own case to the pope and be reinvested of his titles and benefices.
So excommunication wasn't really uncommon, and it could definitely function as a political weapon. But being cast out of the Church according to canon law was not the same as being stripped of the right to exist by civic law.