The next sentence of "raising children to protect against old age" is "to accumulate grain to prevent hunger". The two sentences put together mean to prepare for a rainy day and take precautions before they happen. "Accumulate grain to prevent hunger" means accumulating food to prevent special situations of food shortage. At this time, having sufficient food reserves can avoid starvation. Just like "raising children to protect against old age", it doesn't mean that everything will be different after giving birth to a son. If you raise a son, you will have someone to rely on when you grow old. It's about how to raise a son, and if you raise a son well, you will be able to protect against old age.
Extended information:
Don’t ignore your daughter just because you are raising a child for old age. She is your own child and should be treated equally. Some families favor sons over daughters, and the sons will be generous with what they want, while the daughters will find various excuses to shirk what they want. The parents will not blame the sons if they do something wrong, but they will beat and scold the daughters if they do something wrong.
When the boy grew up and became the "Su Mingcheng" in "Everything Is Good", the parents realized it was too late and regretted their differential treatment of their children and their excessive treatment of their sons. Indulging children to do willful things makes parents disrespectful and unfilial, and makes them self-centered. By ignoring their daughters, the daughters learn to be grateful for their parents’ upbringing, and the parents feel guilty for treating their daughters like this.
Today is an era of equality between men and women. The "son" who raises children for old age can also be a daughter. A daughter is also the child of her parents and can be filial to her parents when she grows up. So don’t be obsessed with gender and cultivate your children well.