Interplay between shape-phase transitions and shape coexistence in the Zr isotopes