This is also a disagreement I had when I was reading The God Delusion. It doesn't seem to be the case that religion wasn't advantageous at all. I agree that it was likely a by-product, but I do think it served an advantage to humans as a social species at the dawn of civilization. And while I'm not sure whether it still serves a purpose, I do think it shouldn't serve a purpose (or in other words, we shouldn't use it for a purpose.) Ever since the Enlightenment, we have evolved intellectually and started to obey reason as the foundation for truth. The problem with religion is that it fosters faith, and faith is unreliable; it's the antithesis of reason. While it can lead to truth, or to goodness, however you may define it, it does so by accident more often than not, and it also leads to the opposite, which in and of itself is a valid reason to oppose religion. This is to say that unjustified belief shouldn't have a place in determining truth ever since we have found scientific (Enlightenment) and logical (4th century BCE) ways to do the same much more reliably.
Now, I do wonder what Haidt's take would be on that. You say he believes it still serves a purpose. But does he think it should serve a purpose? I didn't even know what his position was on the origins of morality until now, so I do wonder what he has to say about that. But for now, I'm too busy reading other books, unfortunately. I wish I could just eat books in order to absorb their knowledge. I once saw a movie where a kid could do that. Indeed, this would be an amazing ability, assuming that eating books wouldn't bring other disadvantages, such as health issues.