I'm sorry if you've recently experienced this. it's no fun and can leave you hanging, questioning, self-blaming..the list goes on. Since I'm not familiar with your situation, I can only offer insight based on similar experiences from others who may have gone through the same/similar thing.
In Behavior Analysis, we don't look for "motivations", per se as it's too internalized, or something we can't "see". There's other ways we examine behavior. For example, if it's a real push-pull you're in, they may be trying to ge your attention or trying to (literally) run from the relationship. This is common in push-pull situations where they "test" their partner to see if/whether (or how deep) that person's love goes.
They may be stuck in a habit from earlier in their lives that they learned for survival. This is also a very common situation, and yeah it's toxic too. Many "know" when they have this habit in play, but unboxing why and how to fix it is usually too painful - recovery and healing isn't for the weak lol. And, I get it. Healing from a traumatic past or painful relationship experiences (that are often a continuation of early life training), is brutal. Many quit therapy, some start self-medicating, you name it....just to not deal with it.
Some, depending on a formal "diagnosis" (I'm not big on diagnoses), may be doing this type of behavior for the thrill of it, to get a reaction out of someone and because they lack empathy, and/or a conscience.
Regardless of why this beahvior happens, and as painful as it can be walking away, take care of you, and protect your heart <3