I think your question is based on an inaccurate assumption.
You are assuming that these Amalekite children are being killed-punished- for the sins of their ancestors.
That's not 100% correct.
In Judaism, suffering can come for multiple reasons. These reasons can be categorized loosely into two categories: Past and Future.
For a great introduction and explanation of this topic, see "The Informed Soul" by Rabbi Dr. Dovid Gottlieb, pg. 128-156, where he brings 12 different explanations for suffering which are offered in classical Jewish sources and explains them in relation to the past or future.
One practical upshot is that it's possible for someone to suffer even if his past doesn't justify it. There can be other factors which do justify it. And these future factors can even outweigh and override what was earned in the past.
One example he gives, just to explain this concept:
Imagine hiring Bob to work for you. When payday comes, you need to pay him based on the work he did.
Imagine that as you are getting ready to give him his check, you get a call from his social worker telling you that they have 100% confirmed that Bob is planning on using the money to buy a gun and shoot his wife, and that if you pay Bob his money you are actively complicit in the murder. (And for whatever reason if he gets the money the police won't be able to stop the murder- it's a hypothetical situation!)
You now have a conflict- base on past considerations (the work done), you have an obligation to pay him.
Based on future considerations (the planned murder) you have an obligation not to pay him. What do you do?
In this case, the general rule should be not to pay him the money. In other words, the future consideration would win out.
It doesn't remove the past consideration- you still owe him the money- but you will need to pay him in a different way.
This is a general concept of how G-d runs things. He doesn't just take into account what a person is owed based on the past, He also considers future ramifications.
What could be the future justification of killing out Amalekites?
It's really a variation of the old "Baby Hitler" question.
If you had the chance to kill adolf hitler while he was still an infant, thus preventing the Holocaust, would you?
Now generally, this can't be taken too far in a practical sense. We as humans have no way of knowing what a baby would be like when it grows up, and we cannot make such calculations. Who could have predicted what Hitler would become? But if we had a way of knowing the future, so we could know 100% what Hitler would become, then there's a strong argument to kill him as a baby. It's just we are limited.
But G-d's not.
G-d can say that Amalekites (or members of the 7 Caananite nations) are a danger to society and must be eliminated.
In classic Jewish thought Amalek is considered the archrival of Klal Yisrael (the Jewish people).
Klal Yisrael's purpose is to bring the world to a recognition of G-d, and thus elevate the world to the Messianic era of unity and perfection.
Amalek is the enemy, the one trying to prevent the Jewish people from leading the world to this state of perfection. They are the epitome of evil.
(See the Wikipedia site on Amalek, the section on Jewish Traditions, which brings some accurate traditional sources on this issue.)
This being the case, we can reframe the issue. The commandment to wipe out the memory of Amalek- even the children and animals- is because as long as there's a remnant of Amalek around, the world can't reach it perfection. All war, suffering and pain today is because Amalek was never fully wiped out.
Thus the commandment to kill them is the same as a commandment given to kill baby hitler- if it was given from an omnipotent, omniscient being who was reliable.