This is just talking off the top of my head, so correct me if I am wrong.
I don't see a lot of children or even teenagers being selfless to the point of putting their lives at risk, so perhaps the "selfless" gene doesn't come into play until an individual reaches adulthood, presumably after reproduction.
In evolutionary terms, it doesn't matter how long a person lives only how many sucessful offspring the person has, so it doesn't matter if the person sacrifices him/herself after the genes have been passed on.
If this is indeed the case, the "selfless" gene could easily be passed on like the dominant genetic disorders that don't effect individuals until middle age such as Huntington Disease.