This is not really working in HAProxy and needs to be fixed.
The proper way is to have hooks from rc.carp[backup|master] call packages when this happens.

If you want to have support for this that is the best path to follow.