The theory of RNA-mediated gene evolution