I’m the furthest thing from an expert on either history or canon law, but I don’t think you’re pegging excommunication accurately. Generally speaking, you aren’t excommunicated for committing serious sin, or even doubleplusungood sin.
Wikipedia lists 10 causes for automatic excommunication (
obscuro latinus termus):
Apostasy (canon 1364),
Heresy (canon 1364),
Schism (canon 1364),
Desecration of the Eucharist (canon 1367),
Physical violence against the Pope (canon 1370),
Attempted sacramental absolution of a partner in a sin against the sixth commandment of the Decalogue (“Thou shalt not commit adultery.”) (canon 1378 §1),
Ordination of a bishop without papal mandate (canon 1382),
Direct violation of the sacramental seal of confession by a confessor (canon 1388),
Procurement of a completed abortion (canon 1398), or
Being a conspiring or necessary accomplice in any of the above (canon 1329).
Other than abortion, it seems that excommunication is reserved for
religious offenses. So Galileo was not excommunicated because the Pope thought he was an awful person, but because the Pope thought his teachings were damaging to the faith.
I don’t understand why abortion is grounds for an automatic excommunication, but murder is not. Possibly (read: wild uninformed speculation) because murder is more obviously against church teaching?

You’d have to go pretty far to find a Catholic who doesn’t know that the church is against abortion though.
Anybody know?