The autodetect method seems to me a bit challenging.
On graphics cards they put external pull-ups/pull-downs that are sensed after reset prior to be used as output.
Another way is to use an analog pin and with a resistor divider various predefined configurations can be selected (no autodetect here)
I wonder if the LED grounds, replaced by 1 or more GPIO as push pull output could make a different autodetect scheme (the number of GPIO depends on the max current of the LEDs). Then the ground can be disconnected or moved high/low for another way to run an autodetection without ADC?