Martyrdom is self-willed unfitness from an evolutionary point of view, unless misguided Islamic martyrdom-seekers think that screwing the promised 72 virgins will increase their fitness (if that's what they think, too bad for their misguided souls, because the text apparently promises raisins, not virgins....but that's another tale). So how does hard martyrdom, and its softer versions such as the self-imposed chastity of priests (sorry to be disappointing, but little boys don't count towards evolutionary fitness) come about?
After 4 billion years of evolution, how can these various forms of self-willed non-fitness be possible? How can the genomes of any species, much less the most 'advanced' one on earth, still allow it? This has been a driving question in sociobiology, and many answers have been given. Religion is an illusion due to a 'God' gene, that evolved because it leads to group cohesion. Altruistic self-sacrifice perpetuates your relatives' genes. And other post hoc excuses.
Before the field went off the deep end, anthropologists did their duty to point out that culture, the characteristic human way of life, is a phenomenon of its own that basically does not depend on specific genotypes. What's in the human genome in some senses that we don't yet understand is the ability to have culture, not the details of any given culture.
Individual humans can behave in all sorts of ways, and clearly some of them are affected by specific genotypes (like the famous inability to digest milk in adults, or various psychiatric disorders that clearly have a genetic component). But overall, any humans can have any culture. Culture is a phenomenon that evolves in its own way, basically independent of the specific genomes of its bearers.
One can be the most promiscuous or the most martyrial in the same culture. Harems and jihad, prostitutes and priests. The possible states range across the entire spectrum, within any given culture. Clearly too much self-sacrifice would doom a group, but even that has occurred (as in the Spartans defending Thermopylae). But on the scale of human evolution, and given the pre-human billions of years, these things are not specifically tied to specific individuals' genotypes (the two Spartans who passed on Thermopylae later committed suicide, one at home and the other in his next battle).
That we are affected by our genotypes in both our physical traits and our behavior certainly seems true. But that we are pre-determined by them is not an accurate way to view human life. What we are pre-determined 'for' is the ability not to be predetermined for specifics, but to be able to absorb our societal environment (our culture), to assess our specific circumstances in that context, and to act upon it. But the range of action, and the accuracy of our assessment are wide and not, by and large, due to our specific genotype. Or, if they are, as we noted in a recent post on randomness, there is so much individuality that we are largely unpredictable in terms of individual genotypes.
It is the determinism of our nondeterminism that we think should be the object of neuroscience research. How material forces can follow natural law yet, in aggregate, evolve to be unpredictable is as philosophically and scientifically profound a question as any that humans have to think about.