I'm a bit confused by the terminology in the OP of "source A" and "source B". The description sounds to me like there is one intermittent source, and two uses A and B. Use A should take priority over use B, so that when A has any demand, use B is shut off. And downstream, uses A and B would never recombine, they serve separate outlets.
(If I misunderstand, and the two uses are supposed to recombine like in valveman's drawing, then my comments may not be applicable. Or maybe in valveman's diagram the two uses aren't intended to recombine in the normal case, and that valve from the tank to the house is to remain closed).
As to the original question, they do make such a mechanical valve, it can be used with residential fire sprinklers. The idea is that a combined incoming water supply (rather than a separate water meter and lateral for the fire sprinklers) goes to the valve, with residential use on one side, and the fire sprinklers on the other. If you start getting (enough?) flow on the fire sprinkler side, then the valve shuts off the residential outlet. And then if your fire code and officials are agreeable, you only have to design your combined supply for the fire sprinkler demand, rather than the fire sprinkler demand plus some simultaneous domestic demand. Here's an example:
www.tycobuilding.com
Now it's probably not directly applicable to your situation because (a) they are very expensive ($1,000) because of fire safety mumble mumble compliance and (b) these valves would tend to activate rarely or never, whereas you want something that could presumably activate, say, multiple times per day. So the above valve might not be able to handle that level of repeated use.
But it does show that it's mechanically possible, and I wonder if there is anything similar that is designed for your use case.
Cheers, Wayne