I think you're confusing the normal use for these masks with what they are actually capable of doing. Yes, in a surgical setting the masks are worn primarily to protect the patient from the surgeon, but the masks do work both ways. Here's a citation from an infectious disease specialist:
https://www.health.com/condition/cold-flu-sinus/surgical-mas...
>“Yes, a surgical mask can help prevent the flu,” Sherif Mossad, MD, an infectious disease specialist at the Cleveland Clinic, tells Health. “Flu is carried in air droplets, so a mask would mechanically prevent the flu virus from reaching other people.” It would work both ways, says Dr. Mossad, preventing transmission of the flu virus to others and for keeping a mask-wearer from picking up an infection.