2270 Human life must be respected and protected absolutely from the moment of conception. From the first moment of his existence, a human being must be recognized as having the rights of a person - among which is the inviolable right of every innocent being to life.72
Before I formed you in the womb I knew you, and before you were born I consecrated you.73
My frame was not hidden from you, when I was being made in secret, intricately wrought in the depths of the earth.74
Ex-Catholic here.
What you cite is one more glaring inconsistency with how Catholics use the catechism to advance whatever narrative they have. It was thought at one time that such babies went directly to Limbo. Now, the verbiage is they are commended to Gods mercy, since they were not baptized (the automatic ticket to the Pearly Gates). There are some rites that can be said, but no funeral Mass.
I cannot begin to tell you how cruel that is to a grieving parent. I know I was one. But I think most priests dont believe that bullshit either. Mine didnt.
Compare this with how some Catholics view the death penalty. Its pretty clear in the CCC that it should only be used in the most extreme of circumstances, and that given all the ways to protect society, it should be rarely, IF EVER, used. Thus, the context is clear that the Church does not support it. Yet, you hear some say its permissible, totally ignoring that context.
To be consistent, Catholics should follow the seamless garment argument that all life is precious and should be protected and honored from cradle to grave, if they are such good Catholics as they claim to be.
Left all this behind several years ago and never looked back. I was a convert, so I never fully bought most of that faith in the first place anyway.