Well, if you’re both religious and do good for the sake of good, then you can still be good without being religious. So that solves (1).
Morality is “rational” as a solution to a game theoretic problem. You can also derive it via evolution (which is also a game theory solution).