If the Shulchan Aruch primarily rules based on a majority based on the Rif, Rambam and the Rosh, who each (I'm assuming) are usually philosophically internally consistent, then wouldn't the Shulchan Aruch be philosophically internally inconsistent?
No. The philosophy is that majority rules; in that philosophy it is generally consistent.
You could ask the same question about any multi-member court or a legislature. Is it philosophically inconsistent because the majority which rules consists of different individuals each time there is a vote? No, because the philosophy that matters is not the philosophy of each individual, who is not himself the court or legislature anymore than the mailman or janitor is. The relevant philosophy is that of the court itself, which is nothing except the procedures that govern it.
Let us set up the following steps:
- The Shulchan Aruch always follows the majority of Rif, Rambam, and Rosh.
- Each of the three (Rif, Rambam, and Rosh) are philosophically consistent.
- If none of the three ever changed position on a philosophical matter, then the majority view on the philosophical matter can never have changed either.
- If the Shulchan Aruch always follows the majority and the majority can never change, ergo the Shulchan Aruch can never change.
Thus, assuming the premises to be true, it should be mathematically impossible for the Shulchan Aruch to be philosophically inconsistent. Any philosophical inconsistencies that do exist would have to be exceptions to one of the premises – either one of the three sources was inconsistent, or the Shulchan Aruch did not follow the majority in (at least one) of the cases.
If I understand your question and assumptions correctly, I think the answer is no. I think this is what you mean: two different halakhot can depend on the same underlying issue. For example, Rabbi Yehudah and Rabbi Shimon disagree regarding muktze in many cases. Let's say two of those cases are Case A and Case B. So if Posek X rules Case A is not muktze it must be because he holds like Rabbi Shimon and therefore should hold Case B is also not muktze.
Based on your premises, there should be no case where the Shulchan Aruch is internally inconsistent because if Halakhah A really implies Halakhah B, there should be the same majority for both halakhot. Going back to our example above, if The Rosh and Rambam both rule Case A is not muktze and the Rif holds it is muktze, then there should be the same 2-1 split in Case B and the Shulchan Aruch would be consistent. On the other hand, if the Rambam holds C and D, the Rif holds C and -D, and the Rosh holds -C and -D, then halakhot C and D must not actually depend on each other (according to your premises) and there would be no inconsistency for the SA to rule C and -D.
I can't think of a scenario where you'd have consistency among the 3 sources but inconsistency in the SA. Can you construct an example?
Anyway, even if there were such a configuration of rulings, I don't think it would necessarily be "inconsistent." The SA sometimes concludes that as a practical matter we should be machmir on a safek, which can sometimes imply chumrot in both directions. For example, I don't think it would be "inconsistent" to say that since we don't know the exact temperature of yad soledet bo we hold it's a lower number when it comes to the isur to heat food on shabat but that it's a higher number when it comes to returning liquids to the fire.
Separately, as many other responses point out, OP's premises are flawed and/or vague. The Mechaber was not a robot and did not resolve all issues on a "best of three" basis. Furthermore, there are many (apparent) contradictions in the Rosh, Rambam, and Rif. But I do think as you've presented it it's an interesting logic puzzle.