To alleviate severe attenuation of millimeter-wave (mmWave) channel, massive multi-input multi-output (MIMO) in which a large number of antennas are utilized in base station (BS) is a promising solution. However, due to a large number of antennas and limited coherence time of mmWave mobile channel, acquisition of a precise channel state information (CSI) requires a large channel estimation overhead, especially for frequency division duplex (FDD) systems. In addition, due to limited saturation level of mmWave power amplifiers, a flexible pilot length adaptation is required for mmWave communication systems. Likewise, because of a large number of BS antennas, it is difficult to feed back all CSI with high accuracy in FDD massive MIMO systems. There exists a trade-off between feedback overhead and the accuracy of recovered CSI. To resolve these issues, in this paper, we propose a deep learning-based joint optimization of closed-loop FDD massive MIMO systems. Unlike previous deep learning-based approach in which only beamforming (BF) from observation of CSI is composed with neural network, we formulate the entire process of generating BF matrix as a functional optimization problem. We compose a deep learning-based FDD massive MIMO system where the functional blocks including pilot length adaptation, CSI compression, and BF are replaced with neural networks. The neural networks are connected and trained as a single network toward a direction which maximizes network utility. During the training process, each functional block learns its best strategy to maximizes network utility. Through simulation, we confirm that each network learned strategies to maximize network utility by itself.