The Useful Dynamic of Shunning to Help the Suffering Christian
Why do we shun or ex-communicate Christians who indulge in sin even after they are told, told with witnesses and told in front of the congregation? If I extremely excoriate something that you are holding onto - your flesh in the case of unrepentant sin - then, eventually, you are going to try to distance yourself from it. Importantly, this works whether your mind understands your hold on the thing or not. Even if your guts or your subconscious is holding onto the thing, you will be driven from it. Indeed, the battering excoriation will possibly slowly but eventually cause your mind to see a gap between you and it, enabling your mind to see how to let go of it.
Shunning helps the Christian who is suffering under the domination of their flesh. God has that Christian and will not allow him to be too hurt by the shunning - even if that Christian dies - but will help him by allowing Satan to buffet the body, like the Bible says, so the spirit can be saved.