Because they were an 'ungodly' - evil nation within the area God had chosen for His people.
Whenever 'good' comes to a place, evil must be removed - or the evil will/may overtake that which is holy. God's people were 'holy' - not because they were without sin, but because they were God's people, His chosen nation. They had His laws and were under His covenant of promise with them. Anything other than them were of the world and not of God.
The destroyed people were mercifully removed from their evil lives and will be given opportunity to know and choose God at the second resurrection when the world will know God, and be under the rule of Jesus and his saints.
The rest of the dead did not come back to life until the thousand years were complete. Rev 20:5
(don't be confused when reading that verse - it speaks of 'this is the first resurrection' - this refers to the last part of v4)
having a hope in God, which they themselves also await, that there is about to be a resurrection, both of the just and of the unjust Acts 24:15
God's precious creation of humanity (for which Christ died for ALL) are part of a plan of salvation - a plan put in place before the first sin. God's design was that all would experience the horror of sin, and be able to choose His way of living over the other way of evil. Without knowing both - any choice is not adequate for the eternal life God offers to all humanity.
KillingThe killing of children etc is, sadly, a partcollateral damage - just as all other sin experienced since Eden. The promise of a better tomorrow will far outweigh all experience of sin. God's plan required to show all how we are supposed to live and to remove from our lives those things that are evil and focus on that which is holy. In these early days, God is doing the removing for them, or with them, so they too understand the bitter consequences of the way of sin in opposition to God.