How many million generations of proto-humans were having sex without marriage ?
It was all sex without marriage until only a few thousand years ago, and humanity was not struck by lightning or turned to ashes or salt pillars. We all bred like rabbits willy nilly regardless of any beliefs in higher beings.
You are confounding two different and incompatible paradigms.
One is the evolutionary view with humans slowly evolving from lower life forms over millions of years.
The other is the biblical viewpoint where God created the first two people about 6000 years ago, to populate the newly created world.
Since this discussion is about whether sex outside of marriage is a sin (a religious concept) the evolutionary paradigm is out of place here.
That is actually somewhat incorrect. The bible does not actually say the Earth was created 6,000 years ago -or that Adam was the first humanoid.
The translation of one word -"WAS" -which can also should mean "had become" -allows any amount of time between the completion of the Earth and its BECOMING waste and ruin (formless and void, while not incorrect in regard to potential translation -suggests absolute sterility and lack of structure -but "the deep" was already there as the events of Genesis began -so then was the Earth -and the waters needed to be separated from the dry land, etc., such as might be necessary after our own mismanagement of Earth -though a "war in heaven" could also affect other celestial bodies -requiring that they be again properly juxtaposed) - or destroyed, but to an unspecified degree -which then required it to be repaired in preparation for Adam (likely the reason Satan is also called "destroyer"). Adam was the first man by biblical definition -to be made in the image and likeness of God with the potential to become immortal -not scientific definition.
The bible puts Lucifer and a third of the angels on Earth -who staged a coup and were cast back down -before the events in Eden. Satan -who was perfect in his ways before iniquity was found in him -was already Satan in Eden, remember.
Cain was worried that others who found him would kill him -and also found a wife in Nod., etc., etc.
Humanoids may have had sex all willy nilly, but that is not to say there were not consequences -or that monogamy was not a thing for various reasons -such as natural possessiveness -or people realizing it was a good idea for the sake of offspring -and especially to maintain peace and order when people came together as societies.