So he didn't leave Starfleet after all, except for some sort of a leave of absence...
We are never given any story on him leaving in a huff and slamming doors behind him, or some scandal forcing him out, or anything like that. There's no "He's no longer in Starfleet" aspect to it in the movie.
Can remember off hand whether Spock is specifically stated to have left Starfleet, however he was "On Vulcan, apparently to stay" and had no intention of returning. Spock is certainly too methodical to have not properly resigned given that was his intention. look at how he put his affairs in order before going to Romulus.