  We study the evolutionary trend of the total density profile of early-type
galaxies (ETGs) in IllustrisTNG. To this end, we trace ETGs from $z=0$ to $z=4$
and measure the power-law slope $\gamma^{\prime}$ of the total density profile
for their main progenitors. We find that their $\gamma^{\prime}$ steepen on
average during $z\sim4-2$, then becoming shallower until $z=1$, after which
they remain almost constant, aside from a residual trend of becoming shallower
towards $z=0$. We also compare to a statistical sample of ETGs at different
redshifts, selected based on their luminosity profiles and stellar masses. Due
to different selection effects, the average slopes of the statistical samples
follow a modified evolutionary trend. They monotonically decrease since $z=3$,
and after $z\approx 1$, they remain nearly invariant with a mild increase
towards $z=0$. These evolutionary trends are mass-dependent for both samples,
with low-mass galaxies having in general steeper slopes than their more massive
counterparts. Galaxies that transitioned to ETGs more recently have steeper
mean slopes as they tend to be smaller and more compact at any given redshift.
By analyzing the impact of mergers and AGN feedback on the progenitors'
evolution, we conjecture a multi-phase path leading to isothermality in ETGs:
dissipation associated with rapid wet mergers tends to steepen
$\gamma^{\prime}$ from $z=4$ to $z=2$, whereas subsequent AGN feedback
(especially in the kinetic mode) makes $\gamma^{\prime}$ shallower again from
$z=2$ to $z=1$. Afterwards, passive evolution from $z=1$ to $z=0$, mainly
through gas-poor mergers, mildly decreases $\gamma^{\prime}$ and maintains the
overall mass distribution close to isothermal.
