I believe that at the Academy, in classes, you are recognized as a Cadet. When a cadet is assigned to a vessel for training duty, working alongside full officers/teachers, being addressed as Midshipmen would to seem to follow.
That would be the classic British division, cadets in classrooms ashore, midshipmen as sort of junior-junior-officers getting on-the-job experience in the fleet. The USN had something similar before 1912, and though it didn't use a different title, graduate midshipmen had to serve two years in the fleet before commissioning, with a uniform like an ensign but with a narrower stripe.
The thing is, though, when midshipmen were referred to in TOS they were pretty clearly "at the Academy."
It makes much more sense to assume that Kirk graduated from the Academy as an Ensign, the way most cadets do, had the incident with Finney on the Republic some time after that, and later transferred to the Farragut with Captain Garrovick, where he was promoted to Lieutenant. That jibes with everything we're told about Kirk's career in TOS. As the Captain of the Republic was never named, we can assume that this was also Garrovick. That way he can still be Kirk's commanding officer from the day he left the Academy.
Pretty much the way I've always figured it. Ensign Kirk following Garrovick to Farragut and making JG around that time or soon after is not much of a stretch.
The idea of graduating from the Academy as a lieutenant is a little baffling to me. What is the ensign rank for, then?