Bootloader without turning pins on/off when booting up

If your relays are "active-low", you can avoid momentary ON glitches by setting the output state BEFORE you set the pin to an output:

digitalWrite(pin, HIGH);
pinMode(pin, OUTPUT);