It's quite separable from doing good, as there are endless historical examples of people subordinating their existence to a higher power and doing virtually unmitigated evil as a direct consequence.
OTOH, it may be the case that recognizing a very specific kind of higher purpose than one self is deeply linked to doing good, but to the extent that is true I don't think is all that strongly correlated with religion; I do think the right framing of religion is beneficial (and wrong framings harmful) to channeling that pre-existing inclination into good results, but that's a different issue.
My problem is that it applies to theists in a positive way and atheists in a negative way. You complain that hardcore atheists are too critical of the worst of religion, then you say something absurdly critical about atheists.
There are lots of ways to devote oneself to some larger cause or purpose.
So do many of the most evil people. Often, superficially at least, the same higher purpose as good people.
God, certainly, ranks high on that list.