I loved what you said:
We teach people how to treat us.
So true. Also true that we teach people how to treat us based on how we treat ourselves. Yes. The compassion we give ourselves is what can also give others. And we can't give what we don't have, right?
I think there something of the Golden Rule in there somewhere.