In a recent episode of The Orville, captain Ed Mercer of the Union is stuck debating with a member of the Krill, a fanatic and xenophobic race in conflict with Earth's multi-species Planetary Union. He says:
"Look, from what we've seen, when planets first achieve space travel and they venture out into the galaxy and discover that they're just one single species among a vast diversity of lifeforms, they usually react in one of two ways: they embrace and adapt to the fact that they're no longer the center of the universe, or they ratchet up their xenophobia. ... I know fear when I see it. You're afraid to face the fact that your superiority may just be a comforting myth."
Shows like The Orville and Star Trek (from which the first show is inspired) paint the future of humanity with an optimistic brush, a future where we react in the first way mentioned above, we meet up with other spacefaring species and learn to coexist and even form federaions with them. And the intolerant xenophobic aliens are cast as the aggressive antagonists, a problem to be resolved.
Given the current state of affairs, it's a bit hard to be this optimistic about humanity's future. Imagine if first contact with an alien species happened today, with the dominant (yet spiraling) superpower presided over by an openly racist president, and a wave of far-right nationalism across the world facing migrants everywhere. How welcoming would we be towards an entirely alien species, when we can't even be welcoming to our own kind?
I'm sure there's been fiction that covered this angle (District 9 comes to mind), but I'm not sure there's been any that covered the entire transition - from first contact to xenophobic hate groups to somehow leading to planetary unification and eventually to a Star Trek-like future. It would at least be an interesting story, and if we can speculate about how to bring that future about, it might even help us with our present problems too.