Each time you are in a war, you kill innocents and children, as well. It's sad but true. If you consider every state who killed children in a war at some point a terrorist state, then pretty much every single state would be a terrorist one.
Hamas has been ruining civilians' lives for ages. If there would not be a radical step taken against them, they would continue to rule and eventually kill more people than in a conflict like this.
We already had this in WWII. USA threw 2 nuclear bombs at Japan and killed many innocents. However, if they hadn't done that, war would have continued for another, let's say, 20 years which would eventually mean even more deaths.
Hence why I believe that killing more people now in order to preserve more lives in the future is worth it.
On the other hand, it would be definitely the best solution if both israel and palestine had their own state which cares about people.