I've seen a couple examples on the forums of people building their own keyboards for the RPi 500.

With the RPi 500+ the RP2040 keyboard controller was moved from the motherboard to the keyboard's PCB. The narrower ribbon cable has lines for USB and power control, not the full keyboard matrix like on the RPi 500. But the new keyboard would still have to handle power control.

Even on the RPi 500 the RP2040 is programmable, so a replacement keyboard wouldn't necessarily be limited to Raspberry Pi's keyboard matrix if you alter the firmware.