Riva:
If your going to add extra hardware then why not just have another wire on the GND wire of the wind vane that will always be low no matter the state of the reed switch, connect this to another Arduino pin with internal pullup. If it high there is no device, if it's low then the device is plugged in.Capacitors are okay but may need careful selection so not to interfere with pulses at all wind speeds.
pin count.
but your idea of a part of the code that gets executed only when a signal is present seems to fit the requirement based on the extremely limited information presented.
a 'wind sensor' possibly a rotating anemometer, might be 30 RPM with a magnet and reed switch.
without a data sheet we will never know.
another hardware solution is to use an AI pin. test for resistance in setup()
almost all pins on the ESP32 are A/I capable.
use a voltage divider in hardware (power waste if battery powered)
test for value, the voltage would be less than the low value trip on a digital input.
if AI reports a value, then set WindExist flag to 1, set pin to read digital input.