Recent numerical studies of the dark matter density profiles of massive galaxy clusters (M-halo > 10(15) M-circle dot) 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 themass-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 (similar to 16 per cent of the clusters), we observe a shift of the scale radius r(s) 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 similar to 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.