So, consequently, prejudice is something that must be absolutely discouraged. In fact, you mentioned «injustice» as something to be «defeat[ed]», and that an individual can be subject to prejudice (owing to similarities to others) is radically unjust.
Edit: make the intellectual experiment, put yourself in those shoes and run the narration. It's you who has "that" trait. The law enforcement treats you differently. The HR treats you differently. The neighbourhood treats you differently. But you have your individual traits, not the virtual ones. Now put yourself in the other side: there is a trait for the median, and there is an individual there: how much should they rely on the trait of the median? Veeery relatively, and with all alert against pitfalls of bias, would not you say.