Or have a function that can dump part of the retention tank onto the track at the control of the guard / driver?
Yes, anything like that would work.
Infact that may be better because the guard/driver would then be able to dump it when the train is out in the sticks rather than a passenger being able to pull the flush whilst in a station.