Even if some individuals in the group do not reproduce, their relatives in the group do reproduce. So say 1 person self-sacrifices and does not reproduce, and as a result of their sacrifice 10 others in the group survive and reproduce that would not have been able to if the first individual had not self sacrificed. The family all has gene A, so this results in a net gain of 9 individuals with gene A. So the amount of people with gene A increases, even though some individuals with gene A potentially do not survive and reproduce.
If you want to learn more about this kind of thing, look into "Selfish Gene Theory".
Suppose we did not separate these things. In that case, for an entire group to have A, that implies that some ancestor of that entire group had A. But this contradicts the premise that the gene makes people less likely to reproduce.
It works if you accept the idea that genes which are fit in some situations are less fit in others. In that case you could have a person who developed this mutation of feeling suicidal when they feel useless, but it doesn't "activate" because they aren't in a situation where they feel useless. But once a whole group has this gene, then your theory of propagation through siblings/cousins is more plausible.
I believe there is similar thinking for genetic passing of traits like homosexuality.