The db9 gpio driver supports up to three buttons, if you look at the pinout in the wiki. You just have to solder them the right way to the db9 connector. I don’t know if there is a standard for db9 with more than one button, since classic computers like C64 and Amiga had only one.
Maybe you have to modify your joystick then and can not use it at real classic computers anymore, because they might cause damages there.
I think I read somewhere about other GPIO drivers, which support GPIO with many buttons for mame machines.