P.S. Can't they make a safety switch so that gear can't be retracted on the ground?
Yes, some planes have a "squat switch" to prevent such an occurrence. Of course, it introduces a bit more complexity, cost, and another failure point in the system. Damned if you do, damned if you don't....