The plagues were direct judgments against the gods of Egypt. (Several scholars have written on this theme, and a general Google search will provide plenty of examples.) For example, the divine judgment of darkness in Egypt was against Ra, the Egyptian sun-god. The last and consummating judgment was Passover, when the majestic power of Pharaoh, who was deified by the Egyptians, was judged. The death of his firstborn (along with everyone/everything else firstborn) was the sum total judgment of God against the “deity” of Pharaoh and all the gods of Egypt.
Exodus 12:12 (Sefaria)
12 For that night I will go through the land of Egypt and strike down every first-born in the land of Egypt, both man and beast; and I will mete out punishments to all the gods of Egypt, I the LORD. (emphasis added)
But the “deity” of Pharaoh and the gods of Egypt were more than idolatry; these gods represented supernatural evil power. The Pentateuch (Torah) speaks of the alignment of idolatry with supernatural evil power.
Leviticus 17:5-7 (Sefaria)
5 This is in order that the Israelites may bring the sacrifices which they have been making in the open—that they may bring them before the LORD, to the priest, at the entrance of the Tent of Meeting, and offer them as sacrifices of well-being to the LORD;
6 that the priest may dash the blood against the altar of the LORD at the entrance of the Tent of Meeting, and turn the fat into smoke as a pleasing odor to the LORD;
7 and that they may offer their sacrifices no more to the goat-demons after whom they stray. This shall be to them a law for all time, throughout the ages. (Emphasis added)
Deuteronomy 32:16-17 (Sefaria)
16 They incensed Him with alien things, Vexed Him with abominations.
17 They sacrificed to demons, no-gods, Gods they had never known, New ones, who came but lately, Who stirred not your fathers’ fears. (emphasis added)
The Targum Onkelos is very insightful in illuminating this last verse, which indicates that these “demons” are supernatural evil powers.
Deuteronomy 32:16-17 (Onkelos)
...דַבַחוּ לְשֵדִין דְלֵית בְהֹון צְרֹוך
They sacrificed to demons (לְשֵדִין) for whom there is no need...
The Masoretic Text in Hebrew has: “no gods” which this Targum in Aramaic renders interpretively to mean “for whom there is no need,” which is consistent with the Sifrei Devarim 38:13, which points to demon spirits and demon-possession. For example, if they (apostate Israelites) had worshiped the sun, the moon, the stars, and/or the planets, and/or things for which there was a ‘need’ in the world and through whom there was a benefit in the world, the jealousy by God would not have been aggravated; in this case, however, they worship demons personified through idols which, not only do not benefit them, but cause them harm through demon-possession (which is aggravated assault upon the dignity of God according to Sifrei Devarim 38:13). *
So, in summary, the hardening of Pharaoh's heart was part of the visible narrative of the Exodus story. As we delve into written Jewish tradition, however, we see that there was another conflict at work in the invisible realm, and that was the judgment of the gods (or demons) of Egypt.
* Cathcart, K., Maher, M., & McNamara, M. (Eds.). (1990). The Aramaic Bible: The Targum Onqelos to Deuteronomy. (B. Grossfeld, Trans.) (Vol. 9). Collegeville, MN: Liturgical Press, 94-95.