The chemical reactions and pathways resulting in the formation of pectin, a polymer containing a backbone of alpha-1,4-linked D-galacturonic acid residues, as part of the organization and biogenesis of the cell wall.