Yes? I think so. Someone treating you poorly does NOT give you the right to do the same to them. Unfortunately, that's usually our natural instinct, and it really shouldn't be.
I think this is especially relevant when interacting with strangers. As I'm sure we've all experienced, people that we don't even know can be downright rude or obnoxious. And sometimes we might reciprocate their actions with the same sort of attitude. What's interesting about this is that we have NO IDEA what the outlying circumstances of that person's life or day are and what's really causing them to behave in this way.
Maybe this person just lost their job. Maybe a loved one just passed away. And maybe nothing of the sort happened. The point, though, is that we don't know. So, the next time someone treats you less than amazingly, try to be nice. As they say, two wrongs certainly do not make a right. And you just may be a ray of light in the darkness that that person is finding their way through.