Or you could send all the waste heat to a big sump and extract it with a heat pump (dont think that actually exists though) - at extreme temperatures would be worth it.
Recovering significantly energy without causing plumbing issues with clogged hair etc seems difficult however.
You’re using hot water at X gallons per minute while the heater can heat Y<X gallons a minute but the water is extracted from the top of the tank so it stays fairly hot until you’ve used more than half of the tank, then drops like a rock at the end when the supply is exhausted.
Anything that warms the cold water going to your shower slightly reduces the rate of hot water use, which extends the amount of time before you run out, which is more time to heat more water.
I think a big part of the challenge would be in having multiple heat exchangers. Perhaps (if plumbing codes allowed) a plain p-trap could be swapped out for an exchanger unit that also serves as a sewer gas stop.
I don't know anything about thermodynamics; how long would it take to transfer a reasonable amount of energy from waste water into the coolant?
Another issue again, running all these coolant lines back to a central water heater w/another exchanger. It does all sound pretty complicated and expensive.
This is one product (linked below) like this although I think plastic would be fine if a little less thermal conductivity and less expensive than this much copper.
I really want one of these - the >40C water going down my drain being replaced with <20C water into my hot water tank keeps me up at night (figuratively). Such an easy win to exchange some of he heat out. It is on my shopping list for the next house / next renovation.
You should add dhw water temperature sensors to the mix too.