I have adopted a mindset of “it’s always nice to know where you stand with people” for this reason.
Losing people I care about is difficult, but if they only cared for me when I was their doormat, I’m better off without them.
Now, when I realize I’m in a situation with someone who does not value kindness, I make a mental note to deprioritize that relationship. I maintain positive thoughts for the person (in optimism that they will one day know and experience mutual kindness), but I do not make myself available to that person beyond the absolute minimum required or expected of me (for work or family, for example).
In doing this work of deprioritizing and even eliminating certain relationships, I often find that I am left totally alone — as I have clearly spent a lifetime nurturing one-way relationships rather than true friendships.
I find that it’s isolating but not lonely, however, as I realize the relationship I most need to nurture is the one with myself.