Which reminds me. Why isn't Rex a Commander in the first place? He's part of the 501st, and Anakin is the General of the 501st. We also do not see any other high-ranking clone in the 501st other than Rex. It is possible that Anakin's original clone Commander was killed off-screen, however Rex has shown enough courage, tactics, and skill to be put up for the Commander rank. Anakin sure seems to see Rex the same as Obi-Wan views Cody.
Perhaps it is because Jedi Padawans, such as Ahsoka, have the rank Commander in the army, however Rex was still a Captain before Ahsoka became Anakin's Padawan.
I suppose those at LucasFilm thought Captain Rex sounded better than Commander Rex.