It seems that egoists cannot die for others for they have to put themselves first. For an egoist to willingly give his life to save the life of one person is evil but it is different if it is necessary to save the lives of two or more. A person with perfect self-esteem can be willing to die for others so it is compatible with egoism. The egoist wants to die for others when she has to because she knows her mind will persecute her for this evil if she does not so she is better to take the risk of her life.
It is true that each person must put himself or herself first but nobody can do that unless they agree that there are times when it is best to die for others. You cannot be happy with your loved ones unless you would die for them to save them. You cannot be happy in yourself if nobody will die to save you. Martyrdom is a necessary evil in order to promote a sense of egoism. The egoist dies as a martyr for her or his egoism and that is all.