Didn't she also serve with M'Benga at the Starfleet equivalent of a Battalion Aid Station/M*A*S*H unit during the Klingon War of 2256-7, or is my memory playing me false? If my memory is not wrong, presumably she was not a civilian then. If that is the case, she may have returned to civilian life after the Klingon War, gotten a position with the Stanford Morehouse Epigenetic Project, then ended up back on a Starfleet vessel on the exchange program as a civilian, but as former Starfleet, she still holds a reserve status that can be reactivated at Starfleet's discretion. (See: McCoy, Leonard H., ca. 2273)
So, it looks like the writers are doing to the characters what they did with Yeoman/CPO/Commander/MCPO/Lt(jg)/Lt-Commander Rand, as in not give a crap about continuity!
Apparently, M'Benga is a Commander, which would mean he out-ranked Lt-Commander McCoy in TOS unless he gets demoted.
Chapel is stated to be a civilian but has the rank braids of a Lt-Commander and then no braids of an Ensign in TOS (Roddenberry said he believed her to be a Brevet i.e. a provisional Ensign because she was not a Starfleet graduate). In TAS she wears the rank of Lieutenant. In TMP she wears the rank of Lieutenant on her epaulette but has Lt-Commander braids on her sleeves in the closing scene. In STIV she is a full commander.
So it would seem logical that that Chapel studied anatomy, physiology, pathology, chemistry, immunology, genetics etc as part of her biomedical degree and then volunteering as a trauma nurse during the war, possibly even obtaining a formal qualification as a nurse practitioner, capable of prescribing and performing minor surgery.
She then did a post-graduate study in epigenetics and transferred to the Enterprise as a civilian (no formal rank) but was afforded much leeway and even given a unform with a Lt-commander rank, because of her qualifications and also because Sick Bay has only one doctor and a couple of nurses.
She then does a second post-grad in Archaeological medicine.
She leaves the ship but applies to return, this time as a provisional ensign and is formally in post as head nurse and she rises in the ranks from there.