On-surface synthesis relies on carefully designed molecular precursors that are thermally activated to afford desired, covalently coupled architectures. Here, we study the intramolecular reactions of vinyl groups in a poly-para-phenylene-based model system and provide a comprehensive description of the reaction steps taking place on the Au(111) surface under ultrahigh vacuum conditions. We find that vinyl groups successfully cyclize with the phenylene rings in the ortho positions, forming a dimethyl-dihydroindenofluorene as the repeating unit, which can be further dehydrogenated to a dimethylene-dihydroindenofluorene structure. Interestingly, the obtained polymer can be transformed cleanly into thermodynamically stable polybenzo[k]tetraphene at higher temperature, involving a previously elusive pentagon-to-hexagon transformation via ring opening and rearrangement on a metal surface. Our insights into the reaction cascade unveil fundamental chemical processes involving vinyl groups on surfaces. Because the formation of specific products is highly temperature-dependent, this innovative approach offers a valuable tool for fabricating complex, low-dimensional nanostructures with high precision and yield.