In a recent study, we used cosmological simulations to show that active galactic nuclei (AGN) feedback on the gas distribution in clusters of galaxies can be important in determining the spatial distribution of stars and dark matter in the central regions of these systems. The hierarchical assembly of dark matter, baryons and black holes obscures the physical mechanism behind the restructuring process. Here, we use idealized simulations to follow the response of a massive dark matter halo as we feed the central black hole with a controlled supply of cold gas. This removes most of the complexity taking place in the cosmological simulations that may have biased our previous study. We confirm our previous results: gas heated and expelled from the central regions of the halo by AGN feedback can return after cooling; repeated cycles generate gravitational potential fluctuations responsible for irreversible modifications of the dark matter mass profile. The main result is the expulsion of large amounts of baryons and dark matter from the central regions of the halo. According to the work presented here, outflow-induced fluctuations represent the only mechanism able to efficiently create dark matter cores in clusters of galaxies.