When uploading pins are not really initialized so on different boards strange thing happen. RAPS128 enable on low signal so are e.g. on at start until gettinig initialized. I have a printer where fan gets full power on upload.
Search for
#if FAN_BOARD_PIN > -1
#if HAVE_HEATED_BED
if(heatedBedController.targetTemperatureC < 15) // turn off FAN_BOARD only if bed heater is off
#endif
pwm_pos[PWM_BOARD_FAN] = BOARD_FAN_MIN_SPEED;
#endif // FAN_BOARD_PIN to find where it is controlled and you find something like this:
#if FAN_BOARD_PIN > -1
#if HAVE_HEATED_BED
if(heatedBedController.targetTemperatureC < 15) // turn off FAN_BOARD only if bed heater is off
#endif
pwm_pos[PWM_BOARD_FAN] = BOARD_FAN_MIN_SPEED;
#endif // FAN_BOARD_PINin kill function but also others that turn it on. Modify it to condition you want or just set pwm for commands you want it to trigger. It is enabled by
pwm_pos[PWM_BOARD_FAN] = BOARD_FAN_MIN_SPEED;