From the Catholic perspective this is not true. People do not Earn heaven, it is a gift. And doing the right thing is good for it’s own sake.
The best analogy I can think of is if a husband says they love their wife, but they never help them, show affection, do anything to serve them, do they really love them? Now in marriage, love should ultimately be unconditional (to a point, all analogies fall down at some point). If a wife loves their husband freely, but the husband says they return the love but do nothing to show it, what can we infer about his love?
The notion that people should do good for its own sake doesn't really change the fact that it's the ticket for Catholicism. Conversely in, say, Calvinism nothing you do can guarantee Salvation.