Perhaps there is need for Gear-Up Inhibit logic.
If ( on 2 engine) if not at least one engine spooled up and producing 90% thrust, stop gear from coming up.
If 4 engines, at least 3 engines not at nn% thrust stop gear from coming up....
Well, something like that just might help next time.