paragraph 24 [of Casti Connubii]:
24. This mutual molding of husband and wife, this determined effort to perfect each other, can in a very real sense, as the Roman Catechism teaches, be said to be the chief reason and purpose of matrimony, provided matrimony be looked at not in the restricted sense as instituted for the proper conception and education of the child, but more widely as the blending of life as a whole and the mutual interchange and sharing thereof.
I came across this other day and I was wondering about it too. How do we reconcile it with the teaching that procreation of children is the primary end of marriage?
It reminds me of the question of whether the glorification of God or the salvation of souls is the primary purpose of the Church.
Children are a good of marriage, not the end of marriage itself. After all, marriages can exist without children (e.g., St. Joseph & St. Mary, infertile couples, couples married beyond child-bearing age, et al.) or even without a desire to have children. What makes a marriage is the consent. Children come about as a result of paying the marriage debt, an act of justice, "the mutual interchange and sharing" of "the blending of life as a whole".
This is clearly expressed in what Pope Pius XI said next:
25. By this same love it is necessary that all the other rights and duties of the marriage state be regulated as the words of the Apostle: "Let the husband render the debt to the wife, and the wife also in like manner to the husband,"[I Cor., VII, 3.] express not only a law of justice but of charity.