I understand where you are coming from OP, if I knew someone working in a particular pharmacy who I didn't want knowing about certain medicines I needed I would be very unhappy if my prescription was sent there, especially against my instructions. I don't know if what was done is illegal, there might be a medical or law professional out there who does know though.
Recently I had a phone call with a practise nurse at our local surgery regarding my son (on speaker phone with him too so he was involved). The result of the phone call meant the nurse was going to have a doctor prescribe something for DS to use before going in for an appointment. Nurse asked if we wanted to pick the prescription up from the surgery or have it sent to the pharmacy.
As the surgery is closer to home than the pharmacies and I go past the surgery 4 times a day on the school run we opted to get it from there, then I could go to a pharmacy of my choosing, or DH could have gone to one in the town he works in during a break time.
Nurse said they'd check if there were dressings at reception, if not they'd have one prescribed as well. Went to pick the prescription up and it had gone to a pharmacy! I have badly damaged my foot and would have found it impossible to walk to the pharmacy at the time, thankfully it was DHs day off so we were driving everywhere (had my own doctors appt and was sent for an x-ray the same day).
I wasn't thinking clearly because of my pain and the effects of strong painkillers so didn't ask if the dressing was on the prescription or there was one at the surgery for us. (Would have looked at the prescription and realised if it was there or not.) Went to pharmacy for prescription, thankfully dressing was on there too, otherwise would have had to of picked one up from surgery or had another prescription sorted.
It wasn't the end of the world in this instance, mainly inconvenient, but if I wanted to use or avoid particular pharmacies for different prescriptions I would not be happy if they were sent to the wrong place. Also just realised DS could have gone for the prescription himself, he might not have known what to do if no prescription at surgery, might have come home and had to go into town, wasting time - would have been inconvenient again.