Does anyone experience this?

I was very, very over an ex from years ago. To the point where I was thinking how greatful I was we didn't end up working  out.

I saw on his instagram he now as a new girlfriend, and it's like my stomach has dropped and I feel like i'm sad again? 

It's a recurring issue for me, has been for as long as I've dated. Exes I don't care for at all...I then become sad at the thought they are dating someone else who isn't me?

Please, any advice welcomed as to how to stop this pattern, why we do it, or if anyone else experiences this.