The omnipresence of super-Earths suggests that they are able to be retained in natal disks around low-mass stars, whereas exoplanets mass distribution indicates that some cores have transformed into gas giants through runaway gas accretion at 1AU from solar-type stars. In this paper, we show that transition to runaway gas accretion by cores may be self-impeded by an increase of the grain opacity in their envelope after they have acquired sufficient mass (typically 10Mearth) to enter a pebble-isolation phase. The accumulation of mm-m size pebbles in their migration barriers enhances their local fragmentation rates. The freshly produced sub-mm grains pass through the barrier, elevate the effective dust opacity and reduce the radiative flux in the cores envelope. These effects alone are adequate to suppress the transition to runaway accretion and preserve super-Earths in the stellar proximity (0.1 AU), albeit entropy advection between the envelope and the disk can further reduce the accretion rate. At intermediate distance (1AU) from their host stars, the escalation in the dust opacity dominates over entropy advection in stalling the transition to runaway accretion for marginally pebble-isolated cores. Beyond a few AU, the transformation of more massive cores to gas giants is reachable before severe depletion of disk gas. This requirement can be satisfied either in extended disks with large scale height via orderly accretion of migrating pebbles or through the mergers of oligarchic protoplanetary embryos, and can account for the correlated occurrence of long-period gas giants and close-in super-Earths.