for example, when he was being tempted by Mara, he said "the Earth bears witness." how do we know this? he was clearly alone, right? no one was there witnessing this to write about it. did Buddha just tell it to everyone later? not just that, there are so many instances in his story where he was clearly alone. no one else could've known about those moments to write about them.
Some of it is in suttas, see for example Buddha meditation under the bodhi tree
The detail you mentioned come from the introduction to Jataka -- Where is the description of the vow and the Bodhi tree?
See also Why did the Buddha touch the earth at his enlightenment? -- people understand that as instructive.
The Buddha is capable of showing images and movies from his mind (like holographic projection) in his sermons to the audiences. One Sutra mentioned, the Buddha shows the scenes of the many worlds (the cosmos) to Ananda. From my reading I've come across the Buddha recounting his enlightenment to the disciples in the Mahisasaka-vinaya - brought back by Faxian (400CE) from Ceylon (Sri Lanka) to China but this vinaya doesn't exist in the Pali "Tipitaka". It infers all other 5 versions of original and earliest vinayas in the Chinese Tripitaka should also recount this event.
Second, the celestial beings are all-knowing, they also bear witnesses to all events that are missing of human observation.
Third, the accomplished disciples - arhats - they could retrieve past events and look into the future. Also they have direct channel to communicate with the celestial beings.
In the ultimate, time and space is not linear.
However, if we human must defile anything that we don't master or understand until it's falsified or mythologized, then nirvana or the perfection of wisdom must be violated too. Since, which human being has mastered or understood it?
A sparrow can never know how humans walking on two legs, a human also can never do flying like a sparrow either. What one doesn't know doesn't endorse the right to refute what it is.
We don't know this and cannot. All we can do is hope to gain enough wisdom to realise why this story is so carefully preserved.
Buddha is said to have turned Mara's dancing girls, sent to tempt him under the Bodhi tree, into cherry-blossom. Is this a true story? If it's meaning is studied it becomes an immensely valuable teaching story and method for dealing with Mara, so who cares? Did Jesus really say, 'Get thee behind me Satan'? The message is that we can defeat Mara with ease if we are Awake, and it would not mean denying the beauty of the temptation.
A great proportion of the literature of the Perennial tradition is attributed to writers who are not the author and there is a reason for this, one of which would sometimes be to convey the idea that it doesn't matter who wrote it. What matters is the words.
Whether we read the Buddhist literature as mythology and metaphor or as historical and scientific fact doesn't really matter. What matters is its usefulness. If we are a practitioner the truth will out.
Buddha mentioned his life story to monks as he went and when it was relevant to particular occasions. You find these discussions in throughout Suttas. Please read the Sutta to clear your doubts.
We cannot know the Buddha was being tempted by Mara & he said "the Earth bears witness". We cannot know whether or not the Buddha reported this to his disciples.
The Refuge in the Dhamma is as follows:
Svākkhāto bhagavatā dhammo sandiṭṭhiko akāliko ehipassiko opaneyyiko paccattaṃ veditabbo viññūhīti
Well taught is the Buddha´s Dhamma, visible here and now, immediately effective, inviting inspection, leading onwards, to be experiened directly by the wise.
The many stories & teachings that fall outside of the above definition are not the essential or true Dhamma.
"earth bears witness" means a lot of hidden meaning in front of temptive Mara( a recollection of Ignorance instincts). To understand this, you must be adult enough & spiritual too.
2 meanings out of them are stated here::
1.) Sexy girls couldn't touch him, sexy boys couldn't touch him, sexy others couldn't touch him because Soil nearby buddha is clear of any footprints, otherwise Mara could've quoted it.
2.) This earth also refers to the base point where karmic dhamma activity occurs at atomic scale. That base point is clean means that buddha is completely free from any 'Sankharas' & they have not arisen & there is not even a trace of any cause&conditions that may lead to arising of sankharas.
This was a statement for an ignorant dweller.
Now, tell me what type of witness would be required in any of the above case. In 1st case, Mara is strong enough to argue in front of buddha anywhere, anytime. In 2nd case also, devas/bak-brahmaas would be enough to point that out.