That is: you want your team to succeed, but you'll accept a little less productivity if the team is fun, or there's less drama, or you feel happy being with your co-workers.
>considering diversity needs //
What are these needs?
I've struggled with this issue recently - in my kids school all the teaching staff are female. All the appointed governors are female too. So the people choosing the staff are females used to working in a female-only environment. There's no [visible or reported] effort to bias towards employing any men. I think not having any men in teaching roles, only the janitor is a man, is a bad thing for all the kids in the school. But, I don't really agree with "positive discrimination" as it's just discrimination and a woman who fails to get the job solely because of her sex would, IMO, be being unfairly discriminated against.
My sense is that the unfair discrimination is perhaps necessary, but it sits very uneasily with me.
To my mind this is the same sort of consideration, choosing a worse candidate because on a broader perspective, considering characteristics of the system rather than only the character, there's a benefit.
tl;dr systemic optimisation rather than local optimisation.