I think it's true but only because of how our society is built. It shouldn't be true otherwise.
However it depends on why you were doing good deeds before. Were you doing it to get respect? Where you doing it to truly help?
I think ratatouille where Linguini releases Remi by the river is the best representation of no good deed goes unpunished but because Remi went through some though shit in the last couple of days, he comes back to Linguini.
It depends. If you are doing good deeds expecting something out of it, even a thank you. Then you shouldn't do them, even a sex worker, a homeless person, a homeless child, a trafficked child, a woman who is beaten by her husband on the street. ALL OF THESE if you'd intervene have multiple possibilities, you could get berated, called names, attacked even if you wanted to help, if you wanted to offer money. I've seen it before, yes, even in the woman being abused physically by the husband case, especially in that one, that doesn't mean all women, that doesn't mean you shouldn't try anymore.
But if you don't relent you'll find someone that wants the help and the people whom you tried might come around at some point.
Glass half empty vs Glass half full. That's what you get doing good deeds, you are never going to get net positive. If you are in it for some positive of any kind, you are in it for the wrong reason and you should stop. The only people who can get net positives out of anything are lucky ones or people who disregard human life/animal life.
By my experience, I should be a misogynistic man who hates the fact that he is actually transgender, that engages in violent consumption of people, that eats animals without any care, that hates every single mother or father for no reason.
But experience doesn't overwrite my nature, I still have some hope for individuals even with the shitty experiences that I had with people. And in the last years it has gotten better and I've seen more and more people fighting and speaking up, so I can see communities and potential friends where there weren't before.
It depends on who you are, good deeds aren't pointless in a vacuum but they often DO go unpunished in our society. If you can't deal with that fact, you should do the best deed you can do for yourself and focus on yourself instead. I don't find that of any value so I still try to help others in whatever way I can.