But, that was humanity and it wasn't always perfect or pretty, even in TNG. There were many times were Starfleet's fears shown through, or we would have decisions made based entirely for selfish reasons.
Star Trek is a great show with its optimism, but it never demonstrated a lack of conflict. You had O'Brien struggling with how he felt towards Cardassians, Picard allowing a world to be destroyed, admirals engaging various problems. It's isn't a perfect humanity presented on screen, nor is it one where all divides are eliminated outside of humanity. Humans get along with each other but that doesn't mean that they automatically get along with all other races out there.
TNG may not be my favorite show but I think it did a good job of demonstrating a humanity that did well and a humanity that struggled. Optimism, for me, doesn't mean no conflict. For me, it means being willing to work to find a solution and sometimes humans don't get it perfectly right.
Finally, this is a show that still has to work within a dramatic framework.