On-surface synthesis (OSS) involving relatively high energy barriers remains challenging due to a typical dilemma: firm molecular anchor is required to prevent molecular desorption upon the reaction, whereas sufficient lateral mobility is crucial for subsequent coupling and assembly. By locking the molecular precursors on the substrate then unlocking them during the reaction, we present a strategy to address this challenge. High-yield synthesis based on well-defined decarboxylation, intermediate transition, and hexamerization is demonstrated, resulting in an extended and ordered network exclusively composed of the newly synthesized macrocyclic compound. Thanks to the steric hindrance of its maleimide group, we attain a preferential selection of the coupling. This work unlocks a promising path to enrich the reaction types and improve the coupling selectivity hence the structual homogeneity of the final product for OSS.