So, the main reason for the historical separation (in the European tradition) between doctor and pharmacist was profit motive- you didn't want the person prescribing to have a financial stake in their treatment, else they will prescribe very expensive medicine for all cases. And surgeons in particular do have a profit motive- they are paid per service- and it is well known within the broader medical community that surgeons will almost always choose to cut. And we largely gate-keep this with the primary care physician providing a recommendation to the specialist. The PCP says "this may be something worth treating with surgery" when they recommend you go see a specialist rather than prescribing something themselves, and then the surgeon confirms (almost always).

That pharmacists also provide a safety check is a more modern benefit, due to their extensive training and ability to see all of the drugs that you are on (while a specialist only knows what they have prescribed). And surgeons also have a team to double-check them while they are operating, to confirm that they are doing the surgery on the correct side of the body, etc. Because these safety checks are incredibly important, and we don't want to lose them.