Using a suite of three large cosmological hydrodynamical simulations, HORIZON-AGN, HORIZON-NOAGN (no AGN feedback) and HORIZON-DM (no baryons), we investigate how a typical sub-grid model for AGN feedback affects the evolution of the inner density profiles of massive dark matter haloes and galaxies. Based on direct object-to-object comparisons, we find that the integrated inner mass and density slope differences between objects formed in these three simulations (hereafter, H AGN , H noAGN and H DM ) significantly evolve with time. More specifically, at high redshift (z ∼ 5), the mean central density profiles of H AGN and H noAGN dark matter haloes tend to be much steeper than their H DM counterparts owing to the rapidly growing baryonic component and ensuing adiabatic contraction. By z ∼ 1.5, these mean halo density profiles in H AGN have flattened, pummelled by powerful AGN activity ("quasar mode"): the integrated inner mass difference gaps with H noAGN haloes have widened, and those with H DM haloes have narrowed. Fast forward 9.5 billion years, down to z = 0, and the trend reverses: H AGN halo mean density profiles drift back to a more cusped shape as AGN feedback efficiency dwindles ("radio mode"), and the gaps in integrated central mass difference with H noAGN and H DM close and broaden respectively. On the galaxy side, the story differs noticeably. Averaged stellar profile central densities and inner slopes are monotonically reduced by AGN activity as a function of cosmic time, resulting in better agreement with local observations.