I figure Starfleet Command would have been fine with Kirk saving the planet if he hadn't flown the Enterprise over them in plain view.
Heck even Spock kept saying they hadn't actually violated the Prime Directive until that happened.
My sense from the film was that Kirk was demoted more for falsifying his reports about the incident than for whatever potential prime directive violation might have happened in flying the Enterprise over the Weekians.
Which, to me, seems fair: one can reasonably debate whether exposing a civilization to concepts far outside their experience incidentally to saving them from extinction is a worthwhile risk. Lying to the people who are to review and debate your actions is unacceptable for an organization of grownups.