In interviews, Yann Martel explained why he had religion be such a prominent theme in his books. He felt that religions are a great way of telling a story about our existence. And, Pi's story about the animals on the sea, is a much more pleasant and uplifting and hopeful story than the alternative story of his lone and brutal survival. So, Martel spends a lot of time making Pi out to be a kid who loves all religions because they each present new and appealing stories about our existence. He likes pieces of them all, is accepting of them all, and enjoys reveling in the various intricacies that each presents. Pi loves stories. So, at the end of the book, when the Japanese men are questioning Pi about Richard Parker and the seeming impossibility of that situation, Pi asks him which story they like better, the one with the animals or the one without; they say the one with the animals. Just like life with religion is a better story than life without. Martel wanted to write a story that would require us to take a leap of faith to believe it, just like we have to take a leap of faith to believe in religion; faith is at religion's core. Religion and storytelling are major themes of his book, so that is why he spent so much time with it at the beginning.
I hope that those thoughts help a bit; good luck!