"food, sex, and survival are at the foundation" I would actually say these are derived from a more core compulsion to "Guarantee the success of my blood line". Using this as a foundation allows for self sacrifice to be seen as a means of contributing to the collective good of the individuals social group which would be expected to reciprocate by protecting the sacrificing individuals family (direct or extended); then as Ray says there are a billion variations within this scope created by a mishmash of genetic, social and experience based traits.
Anyway, basically the topic is so huge and intertwining that it has kept, and will keep, philosophers and sociologists musing for a long time to come yet. Maybe if we ever get core AI working it can be modelled out but that is a long way off and in any event would spoil a perfectly good subject to disagree about ;)
