I think the question is self explanatory: Why wait so long?
Welcome to Mi Yodeya and may I say, excellent first question!
The psalmist (136) sings, "Give thanks to God, for His kindness is eternal" twenty-six times. Why so many? Because there were 26 generations of the world until the Torah was given, during which time God supported the world only with kindness.
As we can see, your question is good, without the Torah being given, Hashem had to support the world with only kindness, obviously not ideal.
It says (ibid 68b):
The world exists only for the sake of the Torah. If Torah would cease to be studied, the world would cease to exist.
On that latter point, Reb Chaim writes in Nefesh HaChayim (4:11):
If, at any time, for even a moment, Torah would cease to be studied everywhere, the world would instantly come to an end, for the world constantly survives on the Torah that is studied at that moment.
So why didn't Hashem give the Torah right away? The answer is because the Torah is meant to be accepted by Yisrael, with free will. Free will is an essential part of the Plan, and Torah, because without it, the mitzvot are meaningless, as Rambam writes (Hilchot Teshuva 5):
Every person has the ability to lead a good life and be a tzaddik or to lead an evil life and be a rasha... This is a fundamental concept underlying the whole Torah and its mitzvot. Moshe said (Nitzavim, D'varim 30:15), "Look, I have put before you today a choice of life and good or death and evil." He said as well (Re'eh, D'varim 11:26-28), "See, I put before you today blessings and curses; blesdsings if you obey... and curses if you do not obey God's mitzvot..." In other words, you have the ability to choose between all types of human ac tion, whether good or bad... If this were not so what place would there be for the Torah; with what justice could God punish the rasha or reward the tzaddik if each does not have perfectly free will to choose his own path?
Hashem grants us free will and therefore waited until the time was right.
The following difficult passage in Chagiga 13b-14a illustrates this:
"A river of fire starts to flow before God's throne." (Daniel 7:10) To where does the river flow? It pours onto the heads of the wicked in Gehinom. Who are they? They are the 974 generations that were plucked before the creation of the world and not created.
Rashi says that God had originally intended to make 1000 generations and give the Torah to the 1000th, but he skipped to the 974th, and gave the Torah to Moshe after 26 more generations, and consigned the 974 wicked generations He never created to gehinom.
It says in Bereshit Rabba (3:7):
Rabbi Yehuda bar Simon notes that the Torah (Bereshit 1:5) says of the first day of creation, "It became evening and it became morning; one day." The pasuk does not say that God announced, "There shall be an evening; there shall be a morning; these will constitute one day." It simply says, "It became evening." That shows that the progression of time pre-existed the creation. How so? Rabbi Abohu explains that this world was not the first world to be created. Rather, God created many worlds one after the other and destroyed each successively. He said, "I don't like this one; I don't like that one," until this world was created, when He said, "This one pleases Me." That is indicated by the pasuk (ibid. 31), "Behold, it is very good," indicating this world is very good. The previous worlds were not.
In light of Bamidbar 23:19 God is not a man who falsifies, nor human, and changes His mind; does He say and not do, or speak and not fulfill? and Shmuel 1:15:29 God, who gives victory to Yisrael, does not lie nor change His mind, for He is not a man to vacillate, how could the midrash even stomach to speak about Hashem having made worlds and then changing His mind because He didn't like them? The answer is what we have already stated. He requires free will in His Plan, and therefore the giving of the Torah could only happen on our consent, which He doesn't force.
Therefore, getting from the beginnings of His plan to the giving of the Torah was inevitably going to take time. There would be mistakes and even people who were never created because He knew in advance they would not accept the Torah, as the Zohar states very explicitly (Bereshit 25a):
God created successive worlds and destroyed them; those that would not keep the mitzvot of the Torah.
Hashem set 1000 generations for A to B, and it ended up taking 26. The joy, the relief, the amazing day when Avraham's descendants, who earned the name Yisrael, used their precious free will to choose to accept Hashem and His Torah, is recounted in Shemot 19:8:
The people together responded and said, "All that God said we will do," and Moshe brought back the words of the people to God.
We can take from all this that the giving of the Torah is very precious and important to Hashem, is something that we are responsible for, and we must keep it wholeheartedly - the whole world depends on it, and matters infinitely to Him.
Welcome to the forum.
In short: Just like our forefathers worked out the Torah from the world and tradition as were we. The Jews as they left Eygpt no longer could rely on this so at that point he gave the Torah. The point is we were never supposed to receive the Torah it was a must. I recommend listening to this podcast https://player.fm/series/18forty-podcast/rabbi-meir-triebitz-how-should-we-approach-the-science-of-the-torah-science-44 Rabbi Tribetz explains based on the Medrash Tanchuma. He says:
It is true that the underlying, the Torah, which is min hashamayim, so on the underlying basis, right?
From heaven, I’m sorry if I interlude with some brief translations.
Rabbi Meir Triebitz:
That’s okay. Right. At the end of Mishpatim, the Torah speaks about that Moshe Rabbeinu came, and to give the Torah to Klal Yisrael, right?
The Jewish people, yes.
Rabbi Meir Triebitz:
The Jewish people, and the Jewish people had a tremendous vision. A tremendous vision. The Torah describes there a tremendous vision they have, kavayachol of a tremendous metaphysical vision. And then, it says, but Hakadosh Baruch Hu, as not to upset the joy of that day, there were certain people who looked at it b’lev gas, meaning that they were eating and drinking, and they didn’t take it, I guess, with the appropriate seriousness that it required. So Hakadosh Baruch Hu says to Moshe Rabbeinu, “Aley elay hahara” –
Come up on the mountain.
Rabbi Meir Triebitz:
Mountain, right, and I will give you, and the pasuk says ” Es luchos ha’even v’haTorah v’hamitzvah asher kasavti lehorosam”. I will give you the Torah. Now in Gemara on daf hey amud alef, in Brachos, the Gemara there says that what is this pasuk referring to? So the Gemara says that it’s referring to the luchos ha’even, which is the two tablets, it’s referring to the Mishna, it’s referring to Nevi’im and Kesuvim, and it’s referring to the Gemara.
It’s all there.
Rabbi Meir Triebitz:
However, what’s interesting is, what happened. In other words, at first they had this incredible metaphysical vision, and after that somehow Chazal tell us that the zekenim, the elder people, somehow they didn’t take the right approach. They looked at it b’lev gas, with a certain arrogance, and therefore Hakadosh Baruch Hu says to Moshe Rabbeinu, I’m going to give you Mishna and Gemara. So you could look at the Meshech Chochma there, he explains the pasuk, “asher kasavti”, so we have to say that there is a Torah of Hakadosh Baruch Hu, and the Torah of Hakadosh Baruch Hu roots the Torah in the truth, in the truth of the physical world. That’s the root of the Torah. But man is not privy to that truth. Man has to learn the Torah, the Mishnah, the Gemara, in other words, in the way in which the Torah should be ba’al peh.
The oral law.
Rabbi Meir Triebitz:
The oral law, the way with the oral law, we have the oral law as tradition. Which means that, in other words, even though the Gemara says, for example, the Gemara says on kuf amud beis in Eruvin that if the Torah was not given, we can learn ethics from the animals. But nonetheless, so that’s the Meshech Chochma [inaudible], that’s called the Torah shekasavti, that’s Hakadosh Baruch Hu’s Torah. But ultimately, science is a human activity. Science is a human activity. Man is supposed to learn the oral law in terms of the Mesorah, the tradition, that we have from the sages, and man should not think that the Gemara, the sages, are privy to this ultimate scientific truth. Which serves as the basis of the Torah, but this is not man’s road, this is what man does. So in my opinion, there’s science, according to the Torah, science is very much a human activity. The Torah, Chazal, the tradition of Chazal are communicating the d’var Hashem, the tradition of the oral law. Not only oral law, but Chazal was speaking in terms of the science of their day. And this is explained by the Chazon Ish, he speaks about this when he speaks about the laws of treifus, animals which are rendered forbidden to be eaten because they’re missing things which they won’t be able to live very much longer, that Chazal in fact actually decided Halachic issues are based upon their science, and we shouldn’t think that Chazal were privy to all the advances of science that we have today. That’s a very, very important thing.
He is saying based on the meshech chochma https://library.alhatorah.org/?r1=Meshekh_Chokhmah_Shemot_24:12 that Hashem felt it was necessary at that point to give the Torah. Although this was not the best thing. The Best thing would be for us to live like they did before like the Avos, and understand the Torah from the world. Understand how Hashem wants us to live our lives without the Torah as it is.