The development of ingroup favoritism in repeated social dilemmas