Recent numerical studies of the dark matter density profiles of massive galaxy clusters (Mhalo > 1015 M⊙) show that their median radial mass density profile remains unchanged up to z > 1, displaying a highly self-similar evolution. We verify this by using the data set of the THE THREE HUNDRED project, i.e. 324 cluster-sized haloes as found in full physics hydrodynamical simulations. We track the progenitors of the mass-complete sample of clusters at z = 0, and find that their median shape is already in place by z = 2.5. However, selecting a dynamically relaxed subsample (∼16 per cent of the clusters), we observe a shift of the scale radius rs towards larger values at earlier times. Classifying the whole sample by formation time, this evolution is understood as a result of a two-phase halo mass accretion process. Early-forming clusters - identified as relaxed today - have already entered their slow accretion phase, hence their mass growth occurs mostly at the outskirts. Late-forming clusters - which are still unrelaxed today - are in their fast accretion phase, thus the central region of the clusters is still growing. We conclude that the density profile of galaxy clusters shows a profound self-similarity out to redshifts z ∼ 2.5. This result holds for both gas and total density profiles when including baryonic physics, as reported here for two rather distinct sub-grid models.