Why is nepotism considered immoral?
You might have heard of the central theme of Yagya Idam na mama.
This saying indirectly implies, anything you give others also is not yours. Then how can you give it only to your friends or relatives considering that it is yours? People do not think of it up to this extent in their daily life even if it is the truth. Without thinking more about it, people usually consider it bad/immoral from their past experience or what they have heard before. They know that nepotism is not good for the smooth functioning of a firm. If it were ethical it would be good for its smooth functioning without any complaints from the other members of that firm even in their minds. So past experience proved that nepotism is immoral. And this is the reason in the case of most people. But even if latent, there is also another main reason for it.
People do not know whether the person who is appointed in one's firm has very good qualities and qualifications required for that firm even though he has. Often most people do not consider it. But they will consider it as a part of nepotism if the guy is a employer's close relative or a person of his own group. People usually do not consider nepotism even if the firm is run by relatives or friends. But if there is a right to include others in that firm, they will use the term 'nepotism'. And it will be considered immoral. Even if what I have considered here is only about appointments, you should extend this to all considerations that fall under nepotism.
There is a great possibility of maladministration when somebody of the employer's category is appointed in the firm of people of different categories; often when there are some employees in that firm who do not fully agree with the employer's decisions. When there is strong attachment, the administrator cannot make firm decisions against the other. This may lead to the creation of caucuses in that firm and eventually to its downfall. And this is also against the laws regarding natural resources.’ Even though there is relation, the term 'natural resources' often do not come in the discussions regarding nepotism. If natural resources were limitless and opportunities are equal, nepotism wouldn't have affected human life. Then nobody would consider it immoral.
https://www.iisd.org/articles/deep-dive/sustainable-use-natural-resources-governance-challenge
For these two reasons, nepotism is immoral even if there may have many beneficiaries. And all similar actions that fall under this category are immoral.
It is generally considered acceptable to prioritize the well-being and
safety of oneself and one's family over the well-being and safety of
strangers.
Is what people think is acceptable really acceptable in all its senses? Covid-19 will have taught everybody the importance of others. In other words, are you sure that no strangers are helping you and your family to survive? If you say 'yes', please read the contents in the first link once again.
So, you can conclude that your first statement is false. root-hairs of morality fixed not only to humans but to all the things essentials for their life. So What is generally acceptable is not always moral.
So your first statement is false and so you cannot ask for differentiating only with one true statement.