This is ignoring that evolution actually punishes selfishness just as much if not more than someone who is altruistic, and also is ignoring that Socialism isn't based on altruism.
Actually it doesn't , greedy (animals that grab the most food) and lazy (animals that waste energy running around for no reason) animals outlive animals that do as they don't starve as quickly. Also some forms of Socialism might not depend on alaturism but Marxism sure does! "From each according to his abilitry and to each according to his need" can be roughly translated in real life terms "Do as little as you can get away with and grab as much as you can. ".