It is unlikely that he is just biding his time with his ex so as to be satisfied physically while hoping that he will end up with you at some point in the future as soulmates.
The both of you dated for a few days and he ended up breaking things off.
Though he told you that he didn’t think that he was ready for a serious relationship, that was most likely untrue.
It didn’t take him long to go back to his prior girlfriend after breaking things off with you.
Even though he told you that he doesn’t have an emotional connection with her nor do they have very much in common, he clearly feels comfortable enough with her to have gone back to her.
If he truly wanted to be with you, he would have at least given the relationship a fighting chance.
Giving up on it only after a few days is not an indication of a guy who truly wants to be with you.
He has been friendly and flirty with you in the past couple of months because he feels like he can behave in this way and get away with it with you.
Being that he is your best friend, he may feel that you would not mind this kind of behavior because he knows you very well and the both of you just click.
You are his safe territory.
With you, he can flirt and joke around freely in a way that he couldn’t with some random girl or some other female coworker who may misconstrue his behavior as a sign that he is interested.
He flirts for fun with the belief that it is harmless because he is doing it with you.
However, none of this behavior means that he has the kind of feelings for you that would make him want to get into a serious relationship with you at some point.
It is best not to overthink what he is doing and risk getting yourself emotionally hooked.
He just flirts with you because he knows that he can do it without consequences.
He gets an ego boost from it.
He doesn’t intend nor does he want the flirting to go beyond just lighthearted fun.
He broke up with you only after a few days because he realized that he was much more comfortable having you as a best friend as opposed to a relationship partner.
He wants to keep it that way.