Regulatory evolution of innate immunity through co-option of endogenous retroviruses