I'm assuming you can't change the nature of the BUTTONS signal -- that it has to take one of nine values between 0V and 5V, equally spaced, where 5V represents "no buttons pressed".
Instead of replacing the buttons with transistors, you should just use three control signals feeding a simple R-2R network to generate the
BUTTONS voltage directly.
Actually, you'll still need one transistor to open up the ground end of the R-2R network when you want to simulate "no button pressed".
Instead of using discrete transistors, use CMOS "transmission gates", such as CD4016 or CD4066, to replace (or in parallel with) the switches.
Just for completeness, there's an approach that allows the sources of the MOSFETs to be tied to ground so that they can be switched by your logic signals. It requires adjusting the values of the voltage divider, though.
simulate this circuit – Schematic created using CircuitLab
Note that the leftmost MOSFET in this diagram corresponds to the rightmost switch in your diagram, and vice-versa.