The idea that people function as rational agents always acting to optimize their self interests is an idea that I think was developed by economists because it helped explain how markets work and made it possible to solve the price-setting problem mathematically using game theory. It has then spilt over into other fields of study such as sociology.
But why did humanity wait until the 1980s to understand that all humans always act in their self interest? Because it is simply not true. People don't constantly reassess whether such or such friendship is a net positive or a net negative. And people don't even have a grid to actually measure what "positive" mean in that context.
The issue is that you can always find a way to derive a selfless action into something self-beneficial. Warren Buffet asking for more taxes is acting in his self interest because it makes him look good and feel all warm inside?
So whatever example I give to answer your question, you'll always be able to find some form of transactional reason that explains why people do things.
If I tell you that some people willfully remain in abusive relationships, you're going to answer something like: it's because they find something in the relationship that is soothing some childhood trauma, and so their self-interest unconscious calculation is that it's better for them to stay in the abusive relationship than to leave.
But that's just taking the whole problem from the wrong end. That's stating that the model of self-interest is universal, and then shoe-horning every human behavior into that model, whether it makes sense or not. So sociologists ask themselves: "mmmmh what self-interest does a person have in going to a friend's funeral", "well surely there is some social benefit or emotional benefit from doing so". So basically, they attribute "unexplainable transactional calculations" to unmeasurable quantities like "social or emotional benefit".
It just doesn't help.