I don't understand how someone can switch so quickly.
He probably doesn't understand it, either. Nor does he have that much control over his emotional lability.
If you feel comfortable talking about it... .did you grow up in an unsafe home? Trauma bonding is more likely to happen if you were subject to intermittent abuse early in your family of origin.
Your ex may be just as mystified why you are left him and are now depressed without him, as you are with his emotional roller coaster. Even if you don't count your actions as needy, can you see how wanting him to fill your emptiness might come across as needy to him? It is relevant only in the sense that many people with BPD are repelled by weakness in others, often the very thing that their actions cause in close others.
It's a good idea to deal with the abandonment depression and anxiety you feel, otherwise how will the cycle of abuse be different going forward?