The recent developed bottom-up on-surface synthesis offers unprecedent opportunities for the fabrication of two-dimensional (2D) carbon-based networks with atomic precision. Hierarchical coupling approach has been proposed as an efficient strategy for improving the corresponding reaction selectivity and quality of target structures. Herein, we report the synthesis of a nitrogen-doped carbon-based network on Ag(100) utilizing a hierarchical Ullmann coupling strategy. The accurate identification of reaction intermediates and products by scanning tunneling microscopy allows us to unravel the reaction mechanism. The synthetic process of 2D carbon-based networks is kinetics-driven, relying on the competition between dechlorination and C-C coupling. We expect that our discussion on the mechanism of hierarchical coupling may shed light on the rational design and precise synthesis of 2D carbon-based networks on surfaces.