"I the LORD thy God am a jealous God, visiting the iniquity of the fathers upon the children unto the third and fourth generation of them that hate me;"
"Israel has sinned; they have violated my covenant [...] they have been made liable to destruction. I will not be with you anymore unless you destroy whatever among you is devoted to destruction."
The Plagues of Egypt were a collective punishment.
Collective punishment is generally considered unjust among humans and during war, it is war crime.