How can you cheaply add an overflow line to protect against blockage in a main line?
Mechanical

For a purely mechanical solution, you may be able to use a pressure relief valve, though this requires the pressure be high enough to trigger it. 



These are fairly common parts, and a variation called a temperature and pressure (T&amp;P) relief vale is installed on hot water tanks. You can get valves with varying pressure ratings/ranges.

I believe when operating near their set point, they do allow some amount of water through (eg, it is not a binary on/off) so you'd have to consider if this is acceptable for your use case (eg, if the pressure drops enough during normal usage that it doesn't normally let water by and if it's acceptable that some does go by).

I think this would really only work properly if your output flow is either zero (so pressure is equal to incoming) or full open (so pressure is minimal).

Electrical

A bit more complex but perhaps more flexible way to do this would be to use a pressure switch on the output side:



This would come on when the pressure is low (you can dial these down to ~20psi or so), so if your output pressure gets too low normally, it would inadvertently trigger this.

You'd wire this to a solenoid on the bypass line.