well, he doesnt have too, but as u said, he let the children live. the thing is, that was the best way from stopping sinning, and also give the children eternal life in heaven because they did before ever commiting sins. so he gave them eternal life in heaven
well, it was a one time thing, and killing a baby for no reason is a different thing than eradicating a violent tribe that commited sins for hundreds of years. and as u said yourself, he let the children live sooooo
also i think it was more of a test if the people were actually killiing the kids or only the sinners