Taking the second argument further, you can not only say that we created religion with an objective; you can say we created God itself in the first place, maybe in order to have an answer for questions we could not answer ourselves.
I guess that the first human beings stared at the sun and thought it was amazing. It gave them light and warmed them up, and they felt so happy in the day for some reason. Maybe it was the same with other weather phenomenon and many other things they couldn't explain. It makes sense, then, that they thought someone or something bigger than them provided those things, or even that those things were bigger beings themselves, controlling the world's fate and humankind's fate too; for example giving them abundancy and better crops, or on the other hand sending storms and making them starve. Given this, it makes sense too that they had an urge to please those beings with prays, offers...to keep them happy.
This also takes me to the fact of lots of co-existing religions and cults. It's an effect of what I said before. If many groups of human beings started in different points of the world, and developed differently, their perception of the world itself must have been really different. Therefore, they must have "created God" in a different way. For example, water sure was important for those living in a desert, the climate was important for those who grew vegetables and animals for those who were expert in hunting, and this is why they focused on one thing or another (thus acquiring different customs, rites...) and why, at the begining, politheist religions were more common.
Sure, you can think "We actually were perceiving God but we were too ignorant or silly to notice". Then I'll ask why God waited till the year 0 to send his son and warn us about our mistake. Or why Allah waited until the year (whatever year it was) to talk to his prophet. No matter how silly we were, surely God would have found a way to guide us to the right path.
That is all, by the moment.
To end this entry, I' ll tell you about Carl Sagan's invisible dragon, specially for you agnostic followers. Sagan's text is not exactly like this, I'm explaining it with my own words:
Imagine someone tells you he has a Dragon in its garage. You think oh cool, a real dragon!, and ask the guy to take you to his garage so you can see by yourself. When you arrive, there's nothing there.You say "Hey, i see no dragons here" and he replies "Oh man, too bad; the dragon's invisible so you can't see it". You notice you can't feel the dragon in anyway either; you can't touch it, smell it or hear it, so you tell the guy, and he says it's a pity but the dragon floats in the air and it's ethereal. What about its fire breathing? Oh, its fire is heatless... And so on.
What's the difference of a dragon with those qualities and no dragon at all? Clearly there's no difference, only that person saying the dragon exists.
Now replace the dragon by...God, spirits, aliens, or whatever belief you can think of. And imagine that not only one person says that they exist, but millions of people. That doesn't make them be true. Sure I can't prove they are fake, specially if people act like the dragon owner, but assuming they do is useless, pointless and definitely not sensible. What is the sensible way then? Moving on, dismissing everything you can't prove (at least until you find further useful evidence for it, if you ever do), and thinking of another hypothesis you can actually prove.