In Thor (2011), it's heavily implied or stated that Norse mythology is based on the Asgardians' battles with frost giants on Earth in the tenth century AD. How were gods like Thor and Loki part of the old stories--with their eventual personalities intact--when they were babies at the time?
According to Marvel's movieverse version of 'Thor', the Frost Giants of Jotunheim, lead by their king Laufey, attacked Tonsberg, Norway in 965 A.D., bent on the conquest of Earth. But they were opposed by Odin and the warriors of Asgard who defeated them in battle. At the end of that battle and after the Frost Giants were driven back to Jotunheim, Odin 'found' a runt Frost Giant baby (Loki) and took him. Odin raised Loki and his 'biological' son Thor together as siblings.
Here's a still of Thor and Loki as adolescents years AFTER the battle of Tonsberg:
They appear to be approximately the same age with Thor being called 'firstborn'. This would make Thor a baby during that battle, not a combatant. Hard to fight a battle in 965 A.D. when you're in diapers. Remember, this is Marvel movieverse mythology, which won't necessarily follow any individual comic.
This would make both Loki and Thor about 1064 years old in 2011. According to 'real' Norse mythology, Thor should have been at least a couple of hundred years old in 965 AD.
Finally, even the opening narrative (as told by Odin to the boys while in the weapons room) is his description of that battle to them. He's telling them the lore while teaching them proper kingship attributes.
With all that being said, apparently Thor had (according to the movieverse) made a few trips to earth after he grew up. Fandral alludes to such visits when Thor convinces Sif and The Warriors Three to sneak off with him to Jotunheim in an attempt to find out how the Frost Giants got into Asgard. Fandral tells Thor, "This isn't like a trip to earth where you can summon a little lightening and be worshipped like a god, this is Jotunheim." This is confirmation that Thor had been to earth as an adult 'God Of Thunder' in MCU. Probably no sooner than about 1000 AD though.
They weren't babies at the time. The flashback showing little Thor and Loki was less than a thousand years ago. A thousand years ago was the last great war on Midgard between Asgard and the Frost Giants. At that time, Odin took the Casket of Ancient Winters, and little Loki from the Frost Giants. Over the next few centuries, Asgard and Midgard continue to be in contact, providing a teenaged/young adult Loki and Thor the opportunity to interact with humans, which led to their inclusion in the Norse myths in the Marvel Cinematic Universe.
This isn't plainly stated in Thor, but can be inferred. The Norse myths book that Selvig gets at the library shows a non-child Thor, meaning that a non-child Thor interacted with humans long ago.
The Marvel Phase 1 timeline provides more concrete evidence. 1000 years ago, Odin took the Casket (and Loki). 400 years later, the Tesseract is lost on Earth, which means Asgardians were on Earth. 400 years is apparently enough time for a child Asgardian and Jotun to grow up.
In The Truth of History (2008), Thor can be seen here:
Meaning, Thor visited Egypt during the construction of Pyramids (2630 and 664 BC). So, when Asgardians' battles with frost giants on Earth in the 10th century AD happened, Thor wasn't a baby.
As for the Loki, it may look like plot inconsistency of MCU, but Marvel's official database never said that Loki was found after the final battle. In fact, there was no final battle. You can see the battle in Thor (2011) too.
Laufey, king of the frost giants, was slain in battle and the giants were defeated. Surveying the spoils of war, the Asgardians discovered a small Asgardian god-sized baby hidden at the giants' main fortress. The infant was Loki, whom Laufey had kept hidden due to his shame over his son's diminutive size. Odin remembered his father Bor’s dying words to adopt the son of a father killed by his hands; Odin adopted Loki into his own family, raising Loki like a son along with his biological son, Thor.
So, Loki might have found after a small battle much before 10th century AD battle.
The old norse myths contains descriptions of many things the gods do, up to and including the Final Battle, Ragnarok.
Now, Ragnarok hasn't happened yet, so clearly the old story tellers were prophets that could see the future.
So, they foretold Thor and Loki long before they were born.