It will depend on the network of urgent cares, they can all have their own system based on their own facilities and what they have. Not every urgent care can do everything and some can do things others can't. Some prioritize differently based on the staff they have at a specific location over another. Many people try to go to an urgent care near them in their network if they have insurance so you'll find different locations have different norms.
TBH so long as it was cost effective either a pharmacy or an urgent care may be a place I go as well for a B12 shot assuming the doctor isn't needing me to consult with them in person on how it's going. It can be hard to get appointments at the doctor's office and if you're just needing something simple like 1 shot it's honestly kinda a waste of an appointment out of the day. But that may be different for someone else. My mother-in-law's old doctor switched to a membership plan where you paid a fee each month and you got priority and access via phone to the doctor at pretty much all hours, but if you didn't pay the membership fee good luck getting an appointment for just a B12 shot especially as they found many of their particular patients appreciated the membership plan and many joined meaning less and less time was available for non-membership patients. That would not be my preferred way of having a doctor but others liked it.
As far as the pharmacy goes I would not try to get a B12 shot if it's during a high uptick in vaccine administration. The pharmacists in my area barely had time to do flu shots much less a B12, they were understaffed, answering phones as quickly as possible, having to fill prescriptions, etc.