The brightest cluster galaxies (BCGs) of today are passive and very massive galaxies at the center of their clusters. They still accrete mass by swallowing companions and flows of cold gas, processes which are regulated by radio-mode active galactic nucleus (AGN) feedback. However, the formation history of BCGs is still a matter of debate. We report new findings based on millimeter observations performed with the Northern Extended Millimeter Array (NOEMA) interferometer mapping the cold molecular gas (CO) that feeds the star formation of distant BCGs. We selected three sources among the strongest cool-core BCGs at intermediate redshifts (z ≃0.4), namely, RX 1532, MACS 1447, and CHIPS 1911. Previous unresolved millimeter observations and multi-wavelength analyses have shown that they are among the most star forming (SFR ≃100 M⊙/yr) and gas rich (MH2 ≃1011 M⊙) BCGs at intermediate redshifts. The selected sources are thus caught in a phase of rapid mass assembly, which makes them ideal targets for high-resolution observations of their molecular gas. We find that all three BCGs show point-like and steep-spectrum continuum emission at millimeter wavelengths, with a spectral slope of α = 0.6, which we interpret as being optically thin synchrotron emission from the AGN. By combining our NOEMA intensity and velocity maps with archival deep optical/infrared images from the Hubble Space Telescope, we unambiguously detected in situ star formation, filaments of accreting cold gas likely regulated by AGN feedback, a disturbed morphology associated with tidal tails of molecular gas, and gas compression and tails originating from the stripping of gas. While effective condensation of the intracluster medium is required to explain the large molecular gas reservoirs, the BCGs exhibit a broad variety of environment-driven mechanisms responsible for the processing of their cold gas: flows of cooling gas (RX 1532), ram pressure or sloshing of the intracluster medium (MACS 1447), and galactic tides (CHIPS 1911). This study thus provides new insights into the physical mechanisms responsible for the mass assembly of galaxies hosting AGN at the center of clusters.