It would be fun to dust DipTrace and draw a PCB for something like this. I suppose (un)fortunately the easy way to do this would be just to take an existing freely available ortho PCB design and extend its firmware as the hardware would be pretty much identical anyway.
I’m clueless about USB enumeration though, not sure if it’s eg. possible for a single hardware device to appear as both a HID device and USB MIDI device at once. So instead of eg. replugging and choosing a mode at startup, one could just have a switch / key combination to determine which “virtual” device will send the keypress data, and sort of alternate between keyboard and MIDI input on the fly.
What would make it fancier hardware-wise would be to use ON-ON switches and make it velocity sensitive. I’m not sure if there are any Cherry / Kailh / Gateron / what-have-you type decent mech keyboard switches that are anything but ON-OFF though. There are experimental / expensive keyboards using IR sensing for determining velocity, but it sounds a bit too complex and expensive for a full keyboard.