Constitutive activation of cellular immunity underlies the evolution of resistance to infection