I'd almost guess that she's been pondering things with ex which is why she asked if you like someone or she may have sensed you liked someone even before you did and then she started pursuing ex, but wanted to check with you first to see if you were still interested. Then when she finds out you're moving on she wants to be sure she has someone else to jump into a relationship with so she doesn't feel alone. Just the franticness of that feeling alone must be awful! :'(
I have noticed the same with my BFF who distances herself when she gets into a new relationship. At first it seemed like her escape, as she was going through a divorce and temporarily staying at her parent's house, they were driving her nuts. So to get away she'd spend more time with boyfriend at his house, doing things she shouldn't be doing to escape her life/feelings/emotions/etc. Then came 2nd boyfriend and she was in a really good place overall, soon to move into her new place and somewhat stable making good money although her job was tiring. Boyfriend #2 actually worked at the job and she eventually got fired over him. Now there is boyfriend #3 who has practically moved in with her, oddly enough it turns out they knew each other since elementary school so in a way I think he feels safe even though he really doesn't know her. He not only knows this girl from forever ago, but the girl she is now just wears a mask so much I don't think he's ever seen beneath it.
Yet, boyfriend after boyfriend, I still have times where I hold her sobbing after she's been texting soon-to-be ex-hubby about how sorry she is that she was a bad wife and how sorry she is that she made him cheat on her! She is so broken yet, instead of the seemingly good guy she has now she'd actually rather go back to hubby who is at minimum emotionally abusive and an awful husband for cheating on her repeatedly? It's so hard to understand, yet somehow I guess since he's seen her at her worst, he's safer than new boyfriend who could see beneath the mask and RUN!
I just watched this great video on BPD relationships on youtube by Alissierrr, a BPD youtuber. She tends to ramble but I think she gives a pretty good explanation about why BPDs go back to exs. (I started this partway into her video, but you may find going back and listening to it all helpful. FYI: it is a long video and there is some cursing so you shouldn't watch if you would find that offensive. If you find her video helpful check out her other uploads, you can even search BPD on her channel to only see those videos, there are a lot of them.)
https://youtu.be/Y43NlNuTnBY?t=12m4s