This is a question about philosophy. Reading the beginnings of Wikipedia's
Any responsible answer to this question has to be highly qualified and surrounded by admissions of ignorance. I’ll try not to get bogged down by describing what we don’t know, but you should realize how inconclusive any answer to your excellent question has to be.
I don’t know enough about non-Western philosophers to tackle that part of the question. Let me say a few words about Thales, Anaximander, Pythagoras, and the rest. Not too long ago the standard claim about them was that they turned thinking decisively away from mythical thinking. Where myths described a world before the world we occupy, an earlier time in which different causes made things happen, these philosophers confined themselves to the world we know and the natural processes at work in this world. So, if they were to describe the origin of the universe, that origin would have to follow causal laws akin to the laws in effect today.
This is our own scientific understanding of the universe today, incidentally. Whatever brought the world into existence must be comprehensible in terms of the processes that bring about changes today.
A few generations after the beginnings of Western philosophy, Melissus of Samos articulated a principle that can be read as an overt statement of that belief. What is now was always the case. Aristotle’s student Palaephatus repeatedly quotes that line from Melissus, and Palaephatus treats the saying (whatever Melissus in fact may have meant by it) as a manifesto about proper explanations. Whatever we assert to have happened then must be of the same order of things as what happens now.
You can see one weakness of this approach to the first philosophers. Palaephatus is writing after Aristotle. The entire tradition of pre-Socratic philosophy already precedes him. He understands philosophy as a break with mythic explanations; I would also argue (and I think most people would agree) that Aristotle understands philosophy in the same way. Aristotle praises Pherecydes for combining general principles of explanation together with his mythological explanations, as if to say that Pherecydes marks a philosophical advance over earlier writers on those grounds.
Where Plato stands on this question is more complex, in my opinion, and I won’t try to address the topic. I will content myself with saying that by the time of Aristotle and then Palaephatus, philosophers were thinking of philosophy as decidedly different from the mythic writing that preceded it.
It doesn’t follow however that the people we’re talking about – Thales and the rest – would have articulated or did articulate their own writings in those same terms. Why would Thales have spoken of magnets having souls, if he took himself to be breaking with mythical frames of reference? Why would Anaximander, whom some consider the first philosopher, have said that things come into existence and then pay the penalty for their injustice in existing, with what sounds to us like a personified story of existence and non-existence, if he were denying the value of mythical modes of explanation?
And yet something is right about this old explanation. Something does change when Thales predicts a solar eclipse on May 28, 585 BC (2,598 years ago yesterday). For now the sun’s eclipse is being treated as a phenomenon to study and to form generalizations about, not a spontaneous intrusion of divine action into the world.
Something also changes when Anaximander, not too long after Thales, proposes that human beings evolved from earlier animals, rather than having been made by gods. Anaximander seeks to explain the origins of the human in processes that would still be at work in the nature of his time.
So, although the simplistic earlier stories about humans making progress out of myth/religion into philosophy/science are one-sided, too easy, and too insensitive to complicating details, there is still an element of truth in those stories that is worth recognizing. This is the beginning of an account of the first philosophical writings.