No, it doesn’t say you can treat someone badly if they treat you badly. It doesn’t say anything about how others treat you having any effect on how you treat them.
It says you should treat everyone the way you’d like them to treat you, regardless if they actually do or not.