There are modern rabbis who have suggested this, likely following in the footsteps of academic biblical scholarship which holds this idea. I assume you're asking for classical sources on the subject. As @shmosel wrote in the comments, this is stated specifically regarding the Nile. In Shemot Rabbah 9:9 it says:
"“On the water that is in the Nile, and it will be turned into blood” – why was the water afflicted first with blood? It is because Pharaoh and the Egyptians worshipped the Nile. The Holy One blessed be He said: I will smite the god first and then his people. This is a folk parable: Smite the gods and the priests will be afraid. Likewise it says: “The Lord will reckon with the host of the high heavens on high,” and after that, [“the kings of the earth upon the earth”] (Isaiah 24:21)."
This idea is also referenced by Rashi on Shemot 7:17.
There's a hint that this was also thought by Chazal regarding the plague of locusts. After Moshe and Aharon demand that Pharaoh let everyone go, he says (Shemot 10:10):
"וַיֹּאמֶר אֲלֵהֶם יְהִי כֵן ה' עִמָּכֶם כַּאֲשֶׁר אֲשַׁלַּח אֶתְכֶם וְאֶת טַפְּכֶם רְאוּ כִּי רָעָה נֶגֶד פְּנֵיכֶם."
The midrash in Yalkut Shimoni on the Torah, remez 392 understood this phrase as referring to a star, i.e., a deity, named Ra'ah (also brought by Rashi on Shemot 10:10; the midrash may have originally come from a version of Shir Hashirim Rabbah1) who will oppose Yisrael. This is most likely a reference to the king of the Egyptian gods, Ra (or Re), who was also the sun god. With regards to the plague of locusts, twice a curious phrase is used:
"וְכִסָּה אֶת עֵין הָאָרֶץ וְלֹא יוּכַל לִרְאֹת אֶת הָאָרֶץ וְאָכַל אֶת יֶתֶר הַפְּלֵטָה הַנִּשְׁאֶרֶת לָכֶם מִן הַבָּרָד וְאָכַל אֶת כָּל הָעֵץ הַצֹּמֵחַ לָכֶם מִן הַשָּׂדֶה." (Shemot 10:5)
"וַיְכַס אֶת עֵין כָּל הָאָרֶץ וַתֶּחְשַׁךְ הָאָרֶץ וַיֹּאכַל אֶת כָּל עֵשֶׂב הָאָרֶץ וְאֵת כָּל פְּרִי הָעֵץ אֲשֶׁר הוֹתִיר הַבָּרָד וְלֹא נוֹתַר כָּל יֶרֶק בָּעֵץ וּבְעֵשֶׂב הַשָּׂדֶה בְּכָל אֶרֶץ מִצְרָיִם." (ibid. 10:15)
It is stated the locusts will "cover the eye of the land". Onkelos understood this phrase as referring to the eye of the sun (likely for, among other reasons, that the next words are "ותחשך הארץ", the land was darkened):
"They covered the visible surface [eye of the sun] of the entire land so that the land was darkened..."
This continues the idea that the plague was intended to 'oppose' Ra, the Egyptian sun god, by blocking his 'eye' (= the physical sun).
1 See מדרש שיר השירים עפ"י כתב-יד ישן מתוך הגניזה שבקהיר, ed. Lazar Grünhut, p. 41, n. 182 [can be found on Otzar Hachochmah]:
"כי רעה נגד פניכם. המאמר הזה מובא בילקוט תשא רמז שצ"ב, ויהושע רמז ט"ו פסוק היום גלותי, ומשם הוספנו החסר בכ"י, וכן מביאו רש"י בשם מדרש אגדה: כוכב אחד וכו', כל הענין כמו שהוא לפנינו, וכן מביאו ביהושע (ה, ט) ומסיים: כך דרש ר' משה הדרשן. ובילקוט תשא מצוין עליו בראשית רבה ושם ליתא, ואפשר שהיה כתוב ב"ר (בראשית רבתי), וסופר טועה כתב "בראשית רבה", ועי' במבוא אודות ר' משה הדרשן ומדרשנו."