A rule of thumb, perhaps:
When trying to discern whether something is a “title” in front of a name, think of whether it sounds “normal and usual” to walk into a room and say, “Good morning, —–.”
We would walk in and say, “Good morning, Doctor (Officer, Sergeant, Judge, Counsel).” These are titles.
We would probably not walk in and say, “Good morning, court reporter (attorney, garbage collector, accountant).” These are job descriptions.
We cap titles in front of names.