That be far from Thee to do after this manner, to slay the righteous
with the wicked, that so the righteous should be as the wicked; that
be far from Thee; shall not the judge of all the earth do justly?’

However, with regards to Makkat Bechorot we are taught (Shmot 12:29-30):

And it came to pass at midnight, that the LORD smote all the firstborn
in the land of Egypt, from the first-born of Pharaoh that sat on his
throne unto the first-born of the captive that was in the dungeon; and
all the first-born of cattle. And Pharaoh rose up in the night, he,
and all his servants, and all the Egyptians; and there was a great cry
in Egypt; for there was not a house where there was not one dead.

This begs the question: Were all of the Egyptian firstborn evildoers?

And if the answer is yes, a follow-up: What was unique about the firstborn that only they were killed, whereas all the other evildoers lived?

1 Answer
1

chabad.org points out that Tehillim 136:10 uses the phrase לְמַכֵּה מִצְרַיִם בִּבְכוֹרֵיהֶם which means that the Egyptians were punished through (or by means of) their bechorim. An analogy could be if Hashem decrees a punishment by a famine, drought, or plague, people will die unless they are tzadikim enough to merit rescue from the "destroyer". In this case as well, once the destroyer was unleashed, it would have required a special miracle (or an extra level of piety - which none of the Egyptian bechorim had) to be spared.

Additionally, the Yalkut Shimoni stateds that a major part of the "makat Bechorot" was that the bechorim, fearing that they would die (as did the cattle during dever), rose up in rebellion against their own parents to force them to send the Bnai Yisrael out.

In Psalms (136:10), Hashem is praised for “lemakeih Mitzraim
bivchoreihem” — “striking the Egyptians through their firstborn.” It
does not say that Hashem struck the firstborn of Egypt but rather that
He struck the Egyptians through their firstborn. This is explained in
the Midrash (Yalkut Shimoni) as follows:

Upon hearing that they would be victims of the last plague, the
“bechorim” — “firstborn” — insisted that Pharaoh and their parents
release the Jews immediately. When their pleas were refused, a civil
war broke out and the desperate firstborn attacked and killed their
parents and fellow Egyptians. Thus, the tenth plague dealt a double
blow to Egypt, killing both firstborn and non-firstborn.

In the Haggadah, the ten plagues are listed as “dam,
tzefardei’a...makat bechorot” — “Blood, frogs...plague of the
firstborn.” The word “makat” is not mentioned for any of the plagues
except for “bechorot” — why?

It can be explained that Rabbi Yehudah argues with the author of the
Haggadah as to what was the major part of the double-blow plague.
According to the author of the Haggadah, the main part was “makat” —
the smiting of the Egyptians by their own angry and violent “bechorim”
— firstborn.

Rabbi Yehudah’s third acronym is "באח"ב". The final "ב" stands for
“bechorot.” He did not make the acronym ",באח"מ" which would have
meant, “Makat bechorot,” because in his opinion the major part of the
plague was Hashem’s slaying of the firstborn, and not the smiting of
the Egyptians by their own firstborn.