I'm not sure what you're surprised about. She has spent roughly 2,000 days with this guy. How many days with you? Of course she's going to miss him. And it may be for awhile.
When you two are fine she doesn't miss him. When she got jealous over the girl she felt lonely and missed her ex. This back and forth is going to be for awhile and it's not going to end well. Unless you keep your head on straight you are in for some serious emotional stress. On both your part and hers. She will be constantly going from you, to the ex, then back to you. Until she's all sorted out and leaves you both behind for someone new.
You're best option now is to just focus on being her escape. Making her your gf will the be the WORST option right now. You already know she has no issues with cheating. And because he is the recent ex, she will likely sleep with him and there isn't much you can do about it. It's called a rebound relationship for a reason.
So take it for what it is. She is on the rebound and cannot provide the right emotional investment in you to have a truly healthy relationship. I mean, if you just broke up with someone you loved for awhile, even if she pissed you off, you'd miss her. Break ups are tough.
By the way, I think the way you handled the initial situation about her telling you she had a bf was flawless. That's exactly how you should have handled it. And looked how it turned out. She broke up with him and has an interest in being with you. That has got to count for something even though in the long run a relationship is a bad idea right now.