The people represented in a work aren’t the only ones who will see it.
Positive representation of marginalized people does more than supporting self-esteem or giving people role models. It also gives people in the privileged group an opportunity to learn to empathize with marginalized people, which has immediate and direct benefits to people oppressed by that privileged group.
A lack of positive and diverse media representation encourages people with greater social power to see marginalized people as two-dimensional stereotypes - often as threatening or irrelevant or both. This perspective translates to how privileged people will approach members of that group in real life, and encourages acceptance of injustice toward that group.
For instance, when the overwhelming majority of media focuses on men and their goals and inner lives, treating women as props to further the journeys of the men around them, it’s both demoralizing to women and dangerous, as men are encouraged to see real women in the same way, and treat them accordingly.
Positive representation has the potential to do the opposite - to challenge dehumanization and the excuses for marginalization. (This is one reason allies of a marginalized group should seek out media that the group says represents them well.)
Much of what we learn about what other people are like comes from media portrayals. Obviously seeing ourselves in media is important - but media representation affects the way we see and treat others as well.