Host traits and environment interact to drive host-pathogen coexistence following pathogen invasion