Proto-planets embedded in their natal disks acquire hot envelopes as they grow and accrete solids. This ensures that the material they accrete - pebbles, as well as (small) planetesimals - will vaporize to enrich their atmospheres. Enrichment modifies an envelopes structure and significantly alters its further evolution. Our aim is to describe the formation of planets with polluted envelopes from the moment that impactors begin to sublimate to beyond the disks eventual dissipation. We constructed an analytical interior structure model, characterized by a hot and uniformly mixed high-Z vapor layer surrounding the core, located below the usual unpolluted radiative-convective regions. The evolution of planets with uniformly mixed polluted envelopes follows four potential phases. Initially, the central core grows directly through impacts and rainout until the envelope becomes hot enough to vaporize and absorb all incoming solids. We find that a planet reaches runaway accretion when the sum of its core and vapor mass exceeds a value that we refer to as the critical metal mass - a criterion that supersedes the traditional critical core mass. It scales positively with both the pollutants evaporation temperature and with the planets core mass. Hence, planets at shorter orbital separations require the accretion of more solids to reach runaway as they accrete less volatile materials. If the solids accretion rate dries up, we identify the decline of the mean molecular weight - dilution - as a mechanism to limit gas accretion during a polluted planets embedded cooling phase. When the disk ultimately dissipates, the envelopes inner temperature declines and its vapor eventually rains out, augmenting the mass of the core. The energy release that accompanies this does not result in significant mass-loss, as it only occurs after the planet has substantially contracted.