I get that, but what about just simple rules?
if(Plane.Altitude > 0 && Plane.FlightTime > 10 Minutes){ TransponderOn }
if(Plane.Altitude > 0 && Plane.FlightTime > 10 Minutes){ TransponderOn }
https://www.google.com/search?q=highest+airport+altitude
Although, I guess you could just check if the landing gear is up. I'm sure there are corner cases I can't think of, but it seems like that would pretty much cover it.
Lastly, I believe all electronics on the plane must be on a breaker circuit in case of electrical shorts so that pilots :can isolate and turn off faulty circuits.