Why is god slaying the sons of Egypt for the sins of their fathers considered just?

I thought people were solely responsible for their own sins.
12 answers 12