How to configure Marlin to enable auto-fans with dual extruder
After trying many different things, I found out that the solution is really simple and requires only a few lines of code. I'll answer my own question in the hope that this will help someone.
First, I defined a few constants (macros actually). To keep my own stuff separate, I created a new file for them called myconfig.h:
#define MY_BED_TEMP_THRESHOLD 50
#define MY_BED_AUTO_FAN_PIN 6
#define MY_BED_AUTO_FAN_SPEED 255

The pin constant corresponds to D6 which is the green marked output of the RRD Fan Extender where I connected the fans under my bed.

Second, in the file temperature.cpp of the Marlin Firmware, I included my file and added four lines of code:
#include &quot;myconfig.h&quot;

... 

#if HAS_AUTO_FAN

  void Temperature::checkExtruderAutoFans() {
  
    ...

    HOTEND_LOOP() {
      if (current_temperature[e] &gt; EXTRUDER_AUTO_FAN_TEMPERATURE)
        SBI(fanState, fanBit[e]);
    }


    // --- start of my code ----------
    if (current_temperature_bed &gt; MY_BED_TEMP_THRESHOLD)
      digitalWrite(MY_BED_AUTO_FAN_PIN, MY_BED_AUTO_FAN_SPEED);
    else
      digitalWrite(MY_BED_AUTO_FAN_PIN, 0); 
    // --- end of my code ------------

    ...

#endif // HAS_AUTO_FAN    
...

Now my fans are automatically turned on while the bed temperature is higher than 50 °C and are turned off again after the bed has cooled down far enough.