If the person voluntarily agreed to be bound by X terms, and X terms are followed, then there is no moral problem.
However, the practice of bonding a child to the debts/obligations of a parent is morally wrong, and such a contract is not valid. In the US, we call this phenomenon Social Security.
So who feeds the child born to two parents in debt?
Hey, debt can be transferred, right? Cool. Old guy, you're about to die, so take my debt for me? Kthx.