It is important to not downplay charity regardless of the motivation.
Self-righteous people give charity to make themselves sleep better at night.
Compassionate people give charity to make the poor person sleep better at night.
Don’t get me wrong, self-righteous people do accomplish a lot. In fact, the nature of self-righteousness is an important engine in getting good things done. Imagine corporations that sponsor cultural events or seasonal soup kitchens.
But usually the nature of self-righteousness blinds the giver to understanding the truth and complexity of the recipient’s situation, whereas compassionate people are more likely to really put themselves into the recipient’s shoes and are thus enabled to think about fixing the problem rather than merely applying a band-aid.