Dynamics of bacterial phenotype selection in a colonized host