We have a tendency to have to see for ourselves how things are. To take God’s word is not enough. We have to learn for ourselves. He tries to set things one way but we think we know a better way.
The following is from the Bible that gives an example of this....
Then I gave them my statutes and made known to them my ordinances, which everyone must keep, to have life through them. Ezeikiel 20:11
But the house of Israel rebelled against me in the desert. They did not observe my statutes, and they despised my ordinances that bring life to those who keep them. My sabbaths, too, they desecrated grievously. Then I thought of pouring out my fury on them in the desert to put an end to them. Ezeikiel 20:13
But their children rebelled against me: they did not observe my statutes or keep my ordinances that bring life to those who observe them, and my sabbaths they desecrated. Ezeikiel 20:21
Therefore I gave them statutes that were not good, and ordinances through which they could not live. I let them become defiled by their gifts, by their immolation of every first-born, so as to make them an object of horror. Ezeikiel 20:25-26
The examples that you gave in regards to kids being destroyed along with the whole city I think fits into this category. It was called a "ban". Other cultures during the OT times would slaughter the whole city as a sacrifice to their god. [each area had a specific god] It was a show off thing. Our god is so great that he deserves the sacrifice of a whole city (Deut. 7:1,2) and our devotion is so strong that we do not take the spoils of war but offer them to God (Josh. 6:17). [ban means "devoted"] I believe that the Israelites got caught into this line of thought. They demanded showing God this devotion to show off how worthy their God was and how devoted they were even though God did not want this type of sacrifice.
“If you had known what these words mean, ‘I desire mercy, not sacrifice,’ you would not have condemned the innocent.” (Matthew 12:7)
It is true that God is ultimately worth all the sacrifice of the world [a perfect one even Malachi 1:11] and it is also true that the Israelites don’t deserve any of the rewards but I don’t believe that this is what God ultimately wanted.
The Bible was not written by God possessing someone and writing for them or dictating to them word for word what to write. The holy Spirit inspires the author and the author uses his own culture and experiences to convey what God is saying. The ban was a half truth that foreshadowed the ultimate true and perfect sacrifice of the cross.