While waiting for a promotion, a less experienced male friend was chosen over me

I used to say there’s no mobbing in the office, but today I was literally shocked. I’ve been working like a dog for two years, running to every task, but they’ve chosen a kid who joined six months after me for the vacant managerial position. When I talked to the boss, he literally said, “You might plan to start a family in the future, so we wanted someone more flexible.” It’s just ridiculous. Honestly, I can’t believe there’s still such discrimination these days. I’m thinking about quitting. Do you think I’m overreacting?