I respect you for having the self-awareness to see that you have these second thoughts. Almost everyone tries to get some form of recompense for their acts of generosity, often in subtle ways that they would never acknowledge.
The day after the big snowstorm, as I was digging my car out, there was a man I didn’t recognize shoveling out the driveway of the house across our street. We exchanged some small talk. I didn’t ask who he was, but he soon managed to tell me that he was a friend of the woman who lived there. She had been stranded out on the road that night, unable to get home, and so he said that he had come by to shovel her house before she got back, “as a good deed”. Those words were like nails on a blackboard.
He probably didn’t expect anything in return from his friend, and I’m sure she was thrilled to see the shoveled drive when she got home. It was a very thoughtful thing to do. But he still needed the recompense of being admired as a do-gooder. He couldn’t, apparently, have come, shoveled, and left without letting someone know what he had done, even if it was just some random dude across the street. But I bet that, unlike you, he was completely unaware of how he was looking to be compensated.
Look, we all have, to some extent, that grasping little ego that clamors for whatever advantage it can get out of a situation. I’m sure there’s some evolutionary justification for that, so it comes as a standard feature in our brain. Fine. But as we grow and ripen as human beings, we also hopefully develop the ability to see that wheedling little voice for the unsavory influence that it is, and just ignore it. Being aware of it is the first indispensable step, and you’re already there.
Now, realize that that grasping ego isn’t you. It’s just a relic of evolution that persists, even though your more evolved faculties are urging a different view. Then take that different view. See past that protesting ego to the realization that if we have any purpose here at all, it’s to make life more pleasant for others. Period.