The intrinsic Helmholtz free-energy functional, the centerpiece of classical density functional theory (cDFT), is at best only known approximately for 3D systems, which hampers the use of cDFT as a powerful tool for describing the intricate thermodynamic equilibrium properties and structural aspects of classical many-body systems. Here we introduce a method for learning a quasi-exact neural-network approximation of this functional by exclusively training on a dataset of radial distribution functions. This method based on pair-correlation matching circumvents the need to sample costly heterogeneous density profiles in a wide variety of external potentials and hence offers a pathway to significantly ease the computational demands for future approaches to extend machine learning for cDFT to arbitrary three-dimensional systems. For a supercritical 3D Lennard-Jones system we demonstrate that the learned neural free-energy functional accurately predicts planar inhomogeneous density profiles under various complex external potentials obtained from simulations, while simultaneously offering precise thermodynamic predictions far outside the training regime.