It is probably resetting when it connects. It it either RH sending a reset, or the uart chip resetting when it connects. I’ve seen both. The only way to solve that is to convince Marlin to start with the motors enabled. I haven’t seen that option anywhere (actually, I sould like that).