What engine??? I know Caterpillar offers reprogram of the ECM to "Latch Mode":
Latch Mode – allows use of exhaust brake when you need it and COASTING when you don’t.
When throttle is closed – Coast
When throttle is closed and service brake applied, the exhaust brake comes on. It stays on whether you continue to use service brake or release service brake.
As soon as you apply any throttle, the exhaust brake turns off.
Note: This does require that the chassis maker did supply the engine ECM with "brake applied" signal.