All tramp needs to do is keep a simple counter of how many times it attempts "exec env TERM='dumb'...."
How many times should be enough? 10? Just count that please. Otherwise even attempting to get traces will blow out one's disk drives. Also maybe it should first send a command to "condition the terminal", similar to stty -echo etc. Then a second command to "exec ..." That way maybe tramp could tell if it got a response or not.
