  We explore the heating and differentiation of rocky planets that grow by
rapid pebble accretion. Our terrestrial planets grow outside of the ice line
and initially accrete 28\% water ice by mass. The accretion of water stops
after the protoplanet reaches a mass of $0.01\,M_{\rm E}$ where the gas
envelope becomes hot enough to sublimate the ice and transport the vapour back
to the protoplanetary disc by recycling flows. The energy released by the decay
of $^{26}$Al melts the accreted ice to form clay (phyllosilicates), oxidized
iron (FeO), and a water surface layer with ten times the mass of Earth's modern
oceans. The ocean--atmosphere system undergoes a run-away greenhouse effect
after the effective accretion temperature crosses a threshold of around 300 K.
The run-away greenhouse process vaporizes the water layer, thereby trapping the
accretion heat and heating the surface to more than 6,000 K. This causes the
upper part of the mantle to melt and form a global magma ocean. Metal melt
separates from silicate melt and sediments towards the bottom of the magma
ocean; the gravitational energy released by the sedimentation leads to positive
feedback where the beginning differentiation of the planet causes the whole
mantle to melt and differentiate. All rocky planets thus naturally experience a
magma ocean stage. We demonstrate that Earth's small excess of $^{182}$W (the
decay product of $^{182}$Hf) relative to the chondrites is consistent with such
rapid core formation within 5 Myr followed by equilibration of the W reservoir
in Earth's mantle with $^{182}$W-poor material from the core of a
planetary-mass impactor, provided that the equilibration degree is at least
25%-50%, depending on the initial Hf/W ratio. The planetary collision must have
occurred at least 35 Myr after the main accretion phase of the terrestrial
planets.
