i'm not sure i follow you then. I am assuming that you have your ipac and optipac mounting in the cabinet, and the swapable panels each have a wire harness that plugs into the ipac. the trackball panel has a second wire harness that connects to the optipac.
so, if that is the case, and you were planning on connecting those two buttons to both encoders, you were going to have to run new wires from those two buttons so that they connect to the optipac harness anyway right? so why not just disconnect them from the ipac harness and only connect them to the optipac harness. then tell mame to use either Ctrl or Mouse 1 for button1 and Alt or Mouse 2 for button2. that way no matter which panel is connected, mame will work fine.
i dont think you can connect them to two different encoders at the same time, it could cause problems