You can implement something like SPI or 1-wire protocol.
You should send PWM signal with low duty cycle (<10%) when the led is off, and high (>80%) for ON state.
By adding some transistor/mosfet/optocoupler you will be able to drive the led with an external 24V supply, additionally with some basic electronics elements your are able to flatten the PWM signal and keep it consistently low (under 0.7V) then the diobe/transistor remains closed so you can eliminate the flashing.
In this case your GPIO pin will act as a clock and the button will pull the signal up or down when the button is pushed. Then on RPi side you should watch for changes - differences from the clock - if the the signal was altered (pulled up or down) then your code can detect and handle the key press.
However, this solution relays on the assumption that the GPIO is able to work in output and input mode simultaneously.
Alternatively you can use GPIO expander board (via I2C), or add a micro controller (Arduino Pico/Nano or a single ATTiny85 chip) to build your own "Serial button board".