"From the firstborn of Pharaoh" (Exodus 12:29) from here we learn that Pharaoh was a firstborn. All the firstborn gathered before their fathers and said to them: Because Moses said, "And every firstborn shall die" (Exodus 11:5) everything that he has said about this people has come upon them. So bring out these Hebrews from among you, for if not, this people will die. They said: Let ten sons belong to one of us, let one of them die, but we will not rise up against these Hebrews. They said: The whole essence of the matter let us go to Pharaoh, who is a firstborn; perhaps he will have pity on himself and bring these Hebrews out from among us. They went to Pharaoh and said to him: Because Moses said, "And every firstborn in the land of Egypt shall die," and everything that he has said about this people has come upon them, so rise and bring out these Hebrews from among us, for if not, this people will die. He said: Go out and break their legs! Shall I give up my own life or the lives of these Hebrews, and you say such a thing? Immediately the firstborn went out and killed sixty myriads of their fathers. This is the meaning of "To Him who struck Egypt through their firstborn" (Psalms 136:10). It is not written here "who struck Egypt among the Egyptians," but rather "who struck Egypt through their firstborn" the firstborn killed sixty myriads of their fathers. Rabbi Avun in the name of Rabbi Yehudah ben Pazi said: Bityah daughter of Pharaoh was a firstborn, and by what merit was she saved? By the prayer of Moses, as it is written, "She perceives that her merchandise is good; her lamp is not extinguished at night" (Proverbs 31:18) it is written "night," as it is said, "It is a night of watching for the LORD" (Exodus 12:42).
Pharaoh the Firstborn and the Night the Firstborn Rebelled
Pesikta DeRav Kahana 7:7
[ז] מבכור פרעה (שמות יב:כט), מכאן שפרעה היה בכור. נתכנסו כל הבכורו' אצל אבתיהם, אמ' להם בגין דאמ' משה ומת כל בכור (שם יא:ה), כל מה דאמ' על הלין עמא אתא עליהון, אלא איתון ונפיק אלין עברייא מביניכון ואי לא הליך עמא מייתין. אמרו, י' בנים לחד מננא ימות חד מנהון ולא תקום על אלין עבריא. אמרין, כל סמא דמילתא ניזיל גבי פרעה דהוא בוכרא, דלמא הוא חייס על נפשיה ונפיק אילין עיבריא מבינינן. הלכו להם אצל פרעה, אמרו לו, בגין דאמ' משה ומת כל בכור בארץ מצרים, וכל דאמ' על הליך עמא אתא עליהון, אלא קום ואפיק אלין עברייא מבינן ואי לא הליך עמא מייתין. אמ' צאו וקפחו שוקיהם של אלו, אנא אמר נפשי או נפשהון דאילין עבראי, ואתון אמרין הכדין. מיד יצאו הבכורות והרגו באבתיהם ששים רבוא, הה"ד למכה מצרים בבכוריהם (תהלים קלו:י), למכה מצרים במצרים אין כתו' כאן אלא למכה מצרים בבכוריהם, הבכורות הרגו באבתיהם ששים רבוא. ר' אבון בשם ר' יהודה בן פזי אמ' בתיה בת פרעה בכורה היתה, ובזכות מה היתה נצולת, בתפלתו של משה, דכתו' טעמה כי טוב סחרה לא יכבה בלילה נרה (משלי לא:יח), ליל כתו', כד"א ליל שמורים הוא לי"י (שמות יב:מב).