ive been really fucking mean my whole life. i was raised by people who act nice and friendly most of the time, but have a habit of being mean to each other at the slightest opportunity; any small shortcoming or failure or misinterpretation was met with petty mocking cruelty. sometimes the cruelty would be wrapped up in a joke, like a candy coating, so you felt like you had to accept it because it's a joke, when the substance of it was actually just as unkind as genuine, unfiltered cruelty. it's been a lifelong practice for me to undo this learned instinct to be mean, and i still fuck up sometimes, when something makes it harder to catch the intrusive thoughts before they become action. but i'm getting better at not being mean. and i'll tell you why.
i think its good to keep other people (and what they're going through) in mind when you're deciding whether or not to make a mean joke, or to just be mean, or mocking, or cruel. but like OP said, that's not really why you should not be mean. in counseling, i was introduced to this idea that i am what i do. everything i do becomes the sum of what i am. every time i want to be mean, or to make a mean joke, or to be rude, or dismissive, or cruel, or petty, im presented with a choice: i can be mean, or i can choose to do something else (be nice, leave, do nothing, etc). and that choice defines the person i want to be. and all the many times i make that choice sum up to the person i am. because what's more important than how your actions affect other people is how your actions define you. that's not just a vague platitude; it is a direct cause-and-effect relationship. you become what you practice.
every time you're mean, you get better at being mean. mean is a skill that gets stronger with practice. every time you're mean, it becomes a little easier to be mean. and not to the people "who deserve it", either. every time you're mean to someone you dont like, it becomes a little easier to be mean to the people you love, as well. because what you practice defines you, it does not define other people. what you do easily to the people you consider your enemies, to the people you hate, will eventually become the things you do to the people you love when you're tired, when you're stressed, when you've had a bad day, when you have low energy to stop it. your default reaction is something you can train. but only if you stop yourself at every chance where you want to be mean and decide, instead, to do something else.
that's not to say you can't, like, defend yourself from attack or whatever. but you really gotta be more selective about your battles. most of them probably actually aren't going to result in anything good if you engage aggressively. if you don't know that yet, you will. practice removing yourself from the situation first. be proactive about it: avoid those situations in the first place. realize that the people who want to pick fights with you have already made up their mind about any outcome, and nothing you can say or do will affect them; it'll just get them defensive, which reinforces their own beliefs to them. You can't win against them. But you can get a win for yourself in the way you react.
yeah, you help define a social space whenever you act within it, which is a well enough reason to be careful about what you do. but the most important reason - the longterm, personal reason - to stop being mean, is because: why would you want to be a person who practices being mean? everything you practice eventually comes back to you. you get to decide what exactly that is.