Why do guys do this?

I noticed a pattern that happens in my dating life and I want to avoid it. I’ll form a crush on a guy and then we’ll become close and start dating, but the moment it feels like things are going to start becoming serious he’ll start flaking on me and ignoring me, and instead he’ll pour that energy into his friends or other girls. Just recently, a guy I’ve been dating for a while made plans to meet, but he told me something personal came up and he wanted to talk about it. Then the next day he had another excuse to not follow up with me about what happened. And then the following day I received a few messages from him apologizing he hasn’t had time, but then I go look at an app we use to play games together and I could see he was online with other girls. When I messaged him back I thought I would get a reply because he was clearly on his phone, but instead I could see him interacting more and more with other girls, leaving them comments like, “you played so good, you deserve to win!” Or “I hope we can play again another time!”

It’s so strange, it’s like they get this impulsive behavior to start giving attention to other girls so I can leave myself instead of having the courage to tell me how they truly feel.