Sweeping the Innocent Away with the Wicked/Many Suffer for the Sin of One

Then Abraham drew near and said, “Will you indeed sweep away the righteous with the wicked? 24 Suppose there are fifty righteous within the city. Will you then sweep away the place and not spare it for the fifty righteous who are in it? 25 Far be it from you to do such a thing, to put the righteous to death with the wicked, so that the righteous fare as the wicked! Far be that from you! Shall not the Judge of all the earth do what is just?” (Gn 18:23-25) God evacuates Lot & his family

Why would God kill even the righteous in Ezekiel 21:3-4? This isn’t fair, and does not make sense knowing that God would have spared even Sodom and Gomorrah had there been even ten righteous people there. (Gn 18:25, 32)

How come God wanted even the children of the Canaanites to be killed? (Dt 20:16)

How could God have even killed the children of Korah’s rebellion? Their servants and slaves? (Nm 16:27, 32-33)

How would one man’s sin (that of the priests) bring sin upon all the people? (Lv 4:3)

I don’t get the parable of the wheat and the weeds. How does it explain why the righteous must suffer by the hands of the wicked, as when the master said that if he pulled out the weeds it would hurt the wheat? (Mt 13:24-30)