It doesn't need to be the tradition that shaped our biology. It could be our biology that shaped the tradition. Assuming we already have some benefit to fasting, a group who make a tradition of fasting are more likely to survive than a group who does not. Thus the fasting meme takes over as the people who believe in it take over.