Rabbi Abahu and Rabbi Ḥiyya the Great, Rabbi Abahu said: Right from the beginning of the creation of the world, the Holy One blessed be He foresaw the actions of the righteous and the actions of the wicked. That is what is written: “For the Lord knows the way of the righteous, but the way of the wicked will perish” (Psalms 1:6).19See Bereshit Rabba 8:4. “The earth was emptiness and disorder” – these are the actions of the wicked.
“God said: Let there be light” – these are the actions of the righteous. But I do not know which He desires, whether it is the actions of these, or the actions of those. When it is written: “God saw the light, that it was good” (Genesis 1:4) – this shows that He desires the actions of the righteous, and does not desire the actions of the wicked. Rabbi Ḥiyya the Great said: Right from the beginning of the creation of the world, the Holy One blessed be He foresaw the Temple built, destroyed, and rebuilt.
“In the beginning God created [the heavens and the earth]” – that indicates [the Temple] being built, as it says: “To plant the heavens and to lay the foundation of the earth and to say to Zion: You are My people” (Isaiah 51:16). “The earth was emptiness and disorder” – that indicates [the Temple] destroyed, just as it says: “I have seen the land, and behold, it is emptiness and disorder” (Jeremiah 4:23).
“God said: Let there be light” – that indicates [the Temple] being built and perfected in the future, as it says: “Arise, shine, for your light has come” (Isaiah 60:1), and it is written: “For, behold, the darkness will cover the earth, and nations, a fog; but upon you the Lord will shine and His glory will be seen upon you” (Isaiah 60:2).