A deceased child would not be condemned to Hell. The Gospels are emphatic in recording Christ's likening of children to God's kingdom.
In the account of the death of King David's infant son, who was born of Bath-sheba, it is also clearly inferred that the child departed to heaven.Matthew 19: 13, 14.
[13] "Then were there brought unto him little children, that he should put his hands on them, and pray: and the disciples rebuked them." [14] "But Jesus said, 'Suffer little children, and forbid them not, to come unto me: for of such is the kingdom of heaven'".
Mark 10: 13-15.
[13] "And they brought young children to him, that he should touch them: and his disciples rebuked those that brought them". [14] "But when Jesus saw it, he was much displeased and said unto them, 'Suffer the little children to come unto me, and forbid them not: for such is the kingdom of God. [15] Verily I say unto you, Whosoever shall not receive the kingdom of God as a little child, he shall not enter therein'".
Parallel account, Luke 18: 15-17.
The speaker in the above passage is King David. Note first the king's decision to stop fasting and weeping upon learning of the death of his son who perished from illness. Had his child passed into Hell, there would clearly have been a greater need to lament and repent than there had been during his sickness. Secondly, and more importantly, the king claims "I shall go to him" which implies he shall one day join him in heaven. For though a person may follow another into the abyss, they cannot go to them.2 Samuel 12: 22, 23.
[22] "And he said, 'While the child was yet alive, I fasted and wept: for I said, Who can tell whether God will be gracious to me, that the child may live?'" [23] "'But now he is dead, wherefore should I fast? can I bring him back again? I shall go to him, but he shall not return to me'".
An act motivated by self-interest is not self-sacrifice. God can neither be fooled nor bound by the technicalities of human legalism. A person cannot supplant goodness of spirit and true righteousness with legalism and except to rise to His kingdom. This is a central theme of Christ's message, and one which brings Him into direct conflict with many pharisees and elders.
Matthew 7: 21-23.
[21] "'Not every one that saith unto me, Lord, Lord, shall enter into the kingdom of heaven; but he that doeth the will of my Father which is in heaven'". [22] "'Many will say to me in that day, Lord, Lord, have we not prophesied in thy name? and in thy name have cast out devils? and in thy name done many wonderful works?'" [23] "'And I will profess unto them, I never knew you: depart from me, ye that work iniquity.'"
Mark 3: 1-6.
"And he entered again into the synagogue; and there was a man there which had a withered hand". [2] "And they watched him, whether he would heal him on the sabbath day; that they might accuse him". [3] "And he saith unto the man which had the withered hand, 'Stand forth'". [4] "And he saith unto them 'Is it lawful to do good on the sabbath days, or to do evil? to save life, or to kill?' But they held their peace". [5] "And when he had looked round about on them with anger, being grieved for the hardness of their hearts, he saith unto the man 'Stretch forth thine hand'. And he stretched it out: and his hand was restored whole as the other." [6] "And the Pharisees went forth, and straightway took counsel with the Herodians against him, how they might destroy him."