Thought is a talent that develops in us.
An infant, in this regard, may be likened to an animal. I say "likened" because there is an important spiritual difference between an infant and a mature animal. However, animals and infants manifest similar behavioral strategies, and so we can use the animal as an analogue for the development of thinking in an infant's brain.
Early in life, the infant is considered to think magically. It constructs its behaviors as a series of stories. When in discomfort, it cries. When happy, it coos and waves its hands. These behaviors elicit responses from the Universe that satisfy its physical and social needs. It does not understand how the Universe succeeds in that regard. This is painfully obvious to any father that tries, over the course of half an hour or so, placating an irritable infant by changing the diaper, offering the bottle, and adding and removing clothing in various combinations, only to learn upon her return from the store that the infant wants to see its mother's face.
In adult animals, we have enough control over the context of its life that we can see magical thinking unfolding as a story. We open the door and whistle, and the dog comes in for dinner. It does not understand the preconditions to its consumption of dinner. We worked to earn money, we bought dog food from the store, and we stored it in suitable conditions to ensure it remained free of contamination.
Let's suppose that our car breaks down and we are unable to buy food for our pet. What kind of trauma awaits the animal when we call it in at night? The story fails. What is it to do next? Many animals suffer the symptoms of depression under such circumstances. It may take hours for them to recover their equilibrium and resume their routine, to the extent possible. Or, its behavior may be irrevocably altered. Fido may stay outside hunting at night until it feels hunger, instead of coming in when we call.
Now, if the dog were human, what would we expect of it? If it were an infant, we would expect it to cry and rage until it evoked a solution from the Universe - pretty much like we would expect from a dog. But if it were an adult, we would expect it to ask why dinner wasn't presented, and to fetch leash, coat, wallet and keys for the journey with master to the store.
This second response has two parts. First, the animal engages in a process of respectful rational inquiry. As described, it seeks to elicit knowledge of the cause of the difficulty, while preserving master's emotional commitment to a solution. Once the difficulty is understood, the animal imagines a new story. The story, involving personal choice by his master, is still magical. But if executed many times over the course of a week, the predictability of the story's outcome makes it a rationally defensible proposition - as was Fido's initial expectation that dinner would be waiting on the other side of the open door.