In this work, an oxidized g-C3N4 film was successfully synthesized using a two-step acid treatment and electrophoretic deposition method. The delocalized π-system of the oxidized g-C3N4 film was extended via an annealing treatment. We investigated the influence of hydrogen bonding reversibility and the oxidation treatment of g-C3N4 on the photoelectrochemical property and photocathodic protection for 304 stainless steel (304 SS). The resulting oxidized g-C3N4 photoelectrode with an extended π-system presents a remarkably enhanced photogenerated electron transfer capability from the photoelectrode to 304 SS (photoinduced OCP negative shift of −0.55 VAgCl) compared with oxidized g-C3N4 and protonated g-C3N4. The oxidation of g-C3N4 facilitates the formation of a porous structure and the introduction of abundant oxygen functional groups, which could promote the effective separation and transport of photogenerated electron–hole pairs. The hydrogen bonding reversibility contributes to the extension of the delocalized π-conjugation system, which could enhance light absorption efficiency. Meanwhile, the annealing treatment is beneficial for prolonging the lifetime of photoelectrons, which could reduce the recombination rate of charge carriers. In addition, to understand how the oxidation treatment and annealing treatment affect the charge transfer behavior, the electronic band structure was investigated, and we found that the oxidized g-C3N4 film with an extended π-system possesses a more negative conduction band position, which could reduce the energy barrier of the photogenerated electron transfer.