The Jews received the Torah with its 613 commandments only at the time of Moses. Until that time, the fact that G-d, rewarded and punished for good and bad behavior as the Torah testifies which indicates some other moral code was in effect at that time. In any case some of the Noachide precepts are spelled out explicitly in Genesis chapter 9.
Also various non-jewish characters in the Tanakh appeal to some moral code in order to make a point on their behalf.
In addition the story of Noah's flood is found in the stories of many different non-jewish cultures. Since, some of the 7 Noachide precepts contradicted activities that the gentiles wanted to do, such as worshiping idols, restraint on certain types of sexual relationships (for example, with adultery with another Man's wife, male homosexuality, etc) robbery, and murder, I see no reason to suspect that a detailed lists of the Noachide laws, would survive outside the Jewish community.
Furthermore, it is well known that before Christianity and Islam reached many countries, those countries were totally pagan. Why is it that some of the details of some of those pagan cultures are totally forgotten today? Because, an opposing ideology used force or bribery to stamp out remembrance of those cultures over the centuries.
So if this could happen to pagan cultures, why not to the Noachide precepts?
If it was to believe that the Tanakh has survived as it was written only because of the Jews, I would have not believed that it survived, but rather ignored it and said "yeah, maybe, among all that is written, something was from God, but we can't know what... if any". The reason I believe the Tanakh has survived is that God wanted it to survive and wanted it to be reliable for the people that followed. If God commanded people to write it (each what he wrote), He should have taken care that what is written is nothing more and nothing less than what He intended to be written and that what is written is preserved as the centuries pass. So, if I didn't believe in God, I couldn't have believed the Tanakh is even a bit of what it was meant, but if I believe in God, then if He commanded people to write something that has survived, then what has survived must be reliable.
so the answer to this question:
"So if this could happen to pagan cultures, why not to the Noachide precepts?"
is that, if God intended it to be preserved, it would have been preserved no matter what. And it would have been preserved so that people would have had accesss to it, if the "Noachide percepts" were required.
About the fact that "various non-jewish characters in the Tanakh appeal to some moral code",
of course that even gentiles have in their nature some moral code: everybody (or, if we consider mental-disease people and alike, almost everybody) has moral code in his nature. But the problem is that it can get perverted by the society and by the teachings he receives, and he can himself do against that moral code.