A 5xx response is still a response, so by default it would be passed onto the client.
I haven't seen a product that goes to the level you mention out of the box. If none do exist, you need a load balancer that allows you to write a custom post response rule, and for that rule to have access to modify the state of the bad node in the pool and feed the request back into your pool. F5 BigIP's, Riverbed StingRay (Zues) certainly offer the scripting element and node management (f5 e.g. down the bottom). Varnish and Squid although not pure load balancers do offer the ability to modify responses post backend response as well. I'm not sure about their access to the node/pool management though. Note that you would also need to deal with request timeouts in the same manner as 5xx responses.
The page you use to monitor a nodes status would also need be something that thoroughly test's the applications status and can be hit quite frequently
The closest HAProxy looks to come to this is
observe <mode> which allows it to react to errors that occur in regular traffic.
I cannot return 5xx error from my app.
At some point it's going to happen, cater for it.