We explore a novel mechanism to restrict TeV-scale leptoquark interactions and render the proton exactly stable to all orders in the effective field theory expansion. A scalar condensate breaks a lepton-flavored U(1) gauge symmetry in the ultraviolet and generates realistic neutrino masses, leaving a discrete Z_9 or Z_{18} gauge symmetry that persists to the deep infrared. This remnant symmetry conserves baryon number mod 3, forbidding proton decay, neutron oscillations and more, while allowing sphaleron-induced leptogenesis. This provides an elegant framework to address the flavour anomalies and can be adapted to many other new-physics models. The U(1) can emerge from a gauge-flavour unified SU(12) x SU(2) x SU(2) theory at even higher energies.