I've always thought this was a silly point in TOS, and was glad they fixed it with Dr. Crusher in TNG, who mostly does appropriate medical things, she doesn't hang out with the captain on the bridge. Just another thing, like Kirk constantly beaming down with away teams, that looks silly when you think about it.
Yes, but in TNG, Troi was always on the bridge -- likely for some of the same reasons, to keep an eye on the emotional well-being of the command crew.
Dramatically, it's the reason why the ship's doctor has such a key role in "Mister Roberts," and why Doc always hung around the jail in "Gunsmoke." They're useful characters when a writer needs a sounding board for others, someone who can cut through rank. (Heck, even Rob Petrie's neighbor was a dentist, as was Bob Hartley's collegaue down the hall. These docs are everywhere! )