Re:McCoy
It's possible that Starfleet, like the current US military, allows some people with experience to enter at a higher rank.
There recently was a story in the paper about a man who just joined the Navy and after being sworn in he was a full Commander because he is a cardiac surgeon with decades of experience.
So perhaps Leonard McCoy MD had enough experience that Starfleet let him join at a higher rank than normal.
Re:Troi's title.
This one gets a little weird, IMO.
It really seems like the title "Counselor" and the position "Ship's Counselor" might be seperate things. Or related, overlapping, but not the same.
The way "Counselor" is used to address Troi directly and when someone refers to her professionally it is always included ("Counselor Troi") suggests it is a title like Doctor.
Perhaps 300 years in the future they have decided that psychiatrists should have a separate title from other MDs.
... But that MDs and PhDs should all still be called "Doctor".
Okay, that makes no sense so it probably isn't right.
But nobody else is routinely addressed by their job title (except maybe "Captains"), so ... there should be a reason.
What I'm saying, I guess, is that the evidence suggests that "Counselor" is a title that Troi has earned, not just the name of her job. But how she earned it and what it means are things we have very little evidence for.
It's possible that Starfleet, like the current US military, allows some people with experience to enter at a higher rank.
There recently was a story in the paper about a man who just joined the Navy and after being sworn in he was a full Commander because he is a cardiac surgeon with decades of experience.
So perhaps Leonard McCoy MD had enough experience that Starfleet let him join at a higher rank than normal.
Re:Troi's title.
This one gets a little weird, IMO.
It really seems like the title "Counselor" and the position "Ship's Counselor" might be seperate things. Or related, overlapping, but not the same.
The way "Counselor" is used to address Troi directly and when someone refers to her professionally it is always included ("Counselor Troi") suggests it is a title like Doctor.
Perhaps 300 years in the future they have decided that psychiatrists should have a separate title from other MDs.
... But that MDs and PhDs should all still be called "Doctor".

Okay, that makes no sense so it probably isn't right.
But nobody else is routinely addressed by their job title (except maybe "Captains"), so ... there should be a reason.
What I'm saying, I guess, is that the evidence suggests that "Counselor" is a title that Troi has earned, not just the name of her job. But how she earned it and what it means are things we have very little evidence for.