Disclaimer: I have not researched a thing about this, there must be plenty much more fleshed out theories roaming around different social circles... I am just "thinking out loud".

I conjecture that the weight (or worth) you assign to someone's opinion, wellbeing, or any sort of existence-related state is in proportion to a, for now unknown, measure of distance between your set of social traits and his or hers. Moreover, humans tend to create clusters around these traits, and you use your tribe instincts to approximate who belongs in these clusters and thus as a proxy for someone else's real worth to you. Finally, I think you - and all of us, humans - should be aware that this is only approximation.

Assume that your social traits - everything that matters for social interaction, your cultural upbringing, religion, political affiliation, personality, class, whatever - are finite and indivisible. Additionally, assume that each of these traits are measurable. That is, it is theoretically possible to completely describe your social being by enumerating a finite number, say \(n\), of social traits and measure them under some relevant scale. Naturally, any other human being could be described by this same set of traits. Under these assumptions, I assume that there is a measure of distance between your trait-vector and any other's. It seems to me, that, due to evolutionary reasons, you value someone's worth in direct proportion to his "social-distance". Obviously, this does not apply only to you. It applies to me, and, naturally, everyone else.

Now, since you are a social beast, you like to hang out with other humans, notably, with other similar humans. For simplicity, let's call them friends (but you and I know you have a much more granulated classification method, and only some lucky few get to be your friends). Interestingly, there is some spillover of traits in this human-to-human interactions, such that the social-distance between you and your friends shrinks with time making you more similar to each other. It is also likely that the shorter the social distance the more time you are prone to hang out with a person. Thus, there is a positive feedback loop where you tend to hang-out more and more with your friends and you are more alike. If you take this behavior and apply it to your friends, it should be possible to notice some clustering trends among them. There's the high school group, the university group, the family, the church group, work, soccer, etc. A lot of groups with different levels of distances, and different traits for which you consider yourself close to each other. Some of these groups are easy to detect - the "siblings" is a super obvious one - others are more nuanced - e.g., politics. More relevant is that these clusters are not necessarily closely knit: not all of your friends in a single cluster need to know each other. This means that there are other group members that you don't know. It makes sense, no? If we were to cluster people by the high school you attended, I would not be disappointed if you did not know all of them. At the same time, this makes some clustering confusing.

Let's take a look at clusters based on political ideology. You might feel that you are right wing because you are pro-life and believe in the free market; however, you also acknowledge that government intervention is necessary and maybe even think that health should be assured by the government. There must be millions who share these views. In fact, there are numerous political quizzes that try to cluster you into one known political denomination. You can be conservative, libertarian, socialist, communist, etc. Most quizzes frame this as a "political spectrum", and there are several variations of it. Some assume its a linear, left-right spectrum, while others offer some 2D plane. In any case, they normally show specific limits at which point you switch from one category to another. This is key. An identical version of you (like you five years ago) with just some tiny tweaks on the political ideology and suddenly you are classified as libertarian instead of conservative. I find this remarkable.

As it happens, these explicit categorizations are useful because they are easier to digest for you. Now, when you go ask a new acquaintance what are his political stance, you might not have the time to go over all the fine points of public policy, but you can get an estimate of his views when he tells you "I'm a socialist" - surely there is plenty you two would disagree on. A different individual might say that she is a libertarian. Hey, that is not so different from you! She is probably someone you could agree with. In short, by creating a discrete categorization we can get a proxy for the distance between your ideology and hers or his. This exact same phenomenon is replicated at the social trait level.

In fact, we are part of countless explicit and implicit categorical groups. We belong to a religion. We consider ourselves vegan. Some of us are introverts, other extroverts. And so on. Each of these categories helps you and me to gauge the social traits of some arbitrary individual. Some categories are clean cut, others are more nuanced, but they all attempt to approximate a subset of our social traits.

Recall that there is a certain spillover of traits between you and your friends that makes you closer. Allow me to extend the idea. When you place yourself into a category, you also tend to absorb some of the traits that are expected from the group. It is as if once you think you belong to some arbitrarily defined cluster of humans you ought to behave like them. Whether this is just the same friend-to-friend interactions mentioned before or there is some direct spillover between the group traits and yours, the real mechanics of how this happens are unknown to me, but I don't think it matters. What matters is that, as time passes by, you adopt many of the social traits that are expected from each of the groups you willingly belong to and those you were assigned to. I hypothesize that the trait-spillover is not of equal magnitudes as it was with your friends: the traits you adopt from the categorical group are likely to be more than those that the group adopts from you. Not surprising, after all if we consider the group as a massive friend, and trait-spillover as some sort of heat-transfer, then we would naturally expect a higher change on the small-body side. The categorical-cluster spillover means that with time groups are more homogeneous.

If social clusters tend towards homogeneity, then the average social distance between any two individuals should be shrinking with time. This means that, with time, you assign greater worth to individuals within groups you belong to. Imagine now that you live in a small town with one larger cluster to which the majority belongs to. Let's call it the Mayos. Assume that you do not belong to the Mayos, and compare the life of a group member, say Alice, with yours. Alice should have a notoriously easier life since most of her peers are Mayos and would value her highly - even if they don't really know her. You, on the other hand, interact mostly with people who have a lesser opinion of you. Let's now include a third subject, Bob, who share most of your social traits, but decided to join the Mayos. Bob suddenly enjoys a higher quality of life just because a random Mayo would approximate a smaller social distance to him and thus assign him higher worth. You, as a rational and observant being, notice this and decide that you will also call yourself a Mayo even if you not really share the core values. I find this social pressure interesting, because no one is really forcing you to join the Mayos, but you are implicitly pressured to.

I imagine there is a plethora of research that covers these topics in-depth. But I believe the core idea holds. We tend to value people with respect to the groups they belong to, and this can generate undesirable behavior if we do not account for it.