TMC2130 External VM RAMPS 1.4
First of all, I'm not talking on a first-hand experience: I don't own a RAMPS based printer.
If I were you and wish to be 100 % sure the setup you are describing doesn't blow up in my face I would use a spare pin on the Mega to drive the relay which, in turn, drive the 24 V source line. In terms of delay I would use a couple of seconds after power on: enough time to have the bootscreen completes and all the pins being set as per firmware configuration.