I don't think it's necessarily a direct route. Yes, non-primates also seem to have a sense of 'morality' -- another reply mentions elephant incident -- but just how closely are religion and morality tied, at least 'at the beginning'?
If religion is tied to 'awe' then it began as a cognitive wondering of why things are as they are. While animals have culture, some even seem to have a sense of 'future,' but not much evidence as to wonder about the nature of things. Combine the awe with curiosity -- the 'why' -- add cultural more and a good dose of creativity and a religion may be born. It needs neither morals nor emotional attachment. But it does require a cognizance beyond non-humans. (Yes, awe is defined as an emotion, but one attached to authority or the sublime. Non-humans recognize authority, but in awe of it?)
So to the question of religion entailing thinking or feeling, I say thinking. Once all the ingredients are there, an influential individual gets others to believe his/her creative idea as to why something happens (like lightning). Once enough are convinced, the idea takes hold. Without a supernatural entity the idea might be 'scientific,' a natural explanation. But it seems more likely that an invisible, supernatural explanation came first.
Once the idea of the supernatural appears, rituals form from 'do this & that happens' coincidences. All that entails thinking, not feeling.
Sorry. I don't think I'm quite explaining my thoughts adequately. (Partly because it takes so long to type them out on the phone.) If someone responds, I'll try to clarify. Try.