I don’t think the Pope was quite that categorically explicit in his discussion.
Excomunication has been used in the past to aid Catholics in their struggle to become holy.
I’ve personally benefited from having a priest at a Christmas vigil Mass tell those assisting that they should refrain from approaching for communion if they had: he gave a list of thinks we should consider and one of the items on the list was failing to assist at Holy Mass regularly. He advised those of us who needed to address any of these issues to come to confession and then to return to communion.
I’d played hooky from Mass in my early adult years and his directive led me to confession. I’m still not perfect, but, thanks to Father, I have a bit more guidance and direction as I continue to be a work in progress.