Being treated badly by other is not a valid reason for you to treat other people badly because you actually always have the option not to treat them badly. It’s a matter of decision. It’s you cannot stop yourself from avenging for yourself. The only reason why you treat other badly is that you’re being a bad person. Period. You may be not a continuous bad person, but you may sometimes become a bad person. And it’s a valid proof that you are not as good as you think you are.
Human aren’t perfect. You will probably do this mistake as I and the other did this. But you can learn from what you and the other have experienced.