(Exodus 7:8-9:) "And the LORD spoke to Moses and to Aaron, saying: When Pharaoh speaks to you, saying, Produce a miracle for yourselves," etc. This is what Scripture says (Isaiah 46:10): "Declaring the end from the beginning, and from of old the things that have not yet been done, saying: My counsel shall stand, and all My desire I will do." What is the meaning of "declaring the end from the beginning"? The Holy One, blessed be He, declares from the start what is destined to be in the end. From where do we know that He spoke thus to Moses? (Deuteronomy 31:16:) "Behold, you are about to lie with your fathers, and this people will rise up and go astray," etc. He told him what Israel was destined to do after the death of Joshua, after a number of years: (ibid.) "and go astray after the foreign gods of the land." And so they did (Judges 2:11): "And the children of Israel did what was evil in the eyes of the LORD, and they served the Baalim," etc. (Deuteronomy 31:16:) "and they will forsake Me and break My covenant" — (Judges 2:12:) "and they forsook the LORD (and did not serve Him)." Thus, "declaring the end from the beginning." Rabbi Pinchas the Priest bar Chama said: Whoever hears this verse might suppose that perhaps there is contentiousness above. (Therefore Scripture) says: "My counsel shall stand, and all My desire I will do" (Isaiah 46:10). Why so? Because the Holy One, blessed be He, does not desire to condemn any creature, as it is said (Psalms 5:5): "For You are not a God who desires wickedness," etc. And so it says (Ezekiel 33:11): "(I do not) [If I] desire the death of the wicked," etc. Thus, "My counsel shall stand, and all My desire I will do" — for the Holy One, blessed be He, desires to declare all His creatures righteous, as it is said (Isaiah 42:21): "The LORD desired, for the sake of His righteousness, to magnify the Torah and make it glorious." Thus, "and all My desire I will do."
God Declares the End From the Beginning Before Pharaoh
Midrash Tanchuma Buber, Vaera 11:1
וידבר ה' אל משה ואל אהרן לאמר כי ידבר אליכם פרעה תנו לכם מופת וגו' (שמות ז ח ט), זש"ה מגיד מראשית אחרית ומקדם אשר לא נעשו אומר עצתי תקום וכל חפצי אעשה (ישעיה מו י), מהו מגיד מראשית אחרית, הקב"ה מגיד מתחילה מה עתיד להיות בסוף, מנין שכך אמר למשה, הנך שוכב עם אבותיך וקם העם הזה וזנה וגו' (דברים לא טז), א"ל מה שעתידין ישראל לעשות אחר מיתתו של יהושע אחר כמה שנים, וזנה אחרי אלהי נכר הארץ (שם), וכך עשו, ויעשו בני ישראל את הרע בעיני ה' ויעבדו את הבעלים וגו' (שופטים ב יא). ועזבני והפר את בריתי (דברים שם), ויעזבו את ה' (ולא עבדוהו) (שופטים שם יב), הוי מגיד מראשית אחרית. אמר ר' פנחס הכהן בר חמא מי שהוא שומע את הפסוק סבור שמא (פקלוניא) [פלונקיא] יש למעלן, אומר עצתי תקום וכל חפצי אעשה (ישעיה מו י), למה כן, שאין הקב"ה חפץ לחייב כל בריה, שנאמר כי לא אל חפץ רשע אתה וגו' (תהלים ה ה), וכן הוא אומר (לא) [אם] אחפץ במות הרשע וגו' (יחזקאל לג יא). הוי אומר עצתי תקום וכל חפצי אעשה, שהקב"ה חפץ לצדק כל בריותיו, שנאמר ה' חפץ למען צדקו יגדיל תורה ויאדיר (ישעיה מב כא), הוי וכל חפצי אעשה.