It was a win win situation for the Federation.
1.>From a diplomatic point of the view, they could say to the Klingons we punished Kirk for voilating orders.
2.>From a Federation PR point of view they have the person who saved Earth not once but twice in command of a starship
3.>Kirk was happy he was back where he wanted to be in the centre seat. Scotty was Chief Engineer of the Enterrpise again.
Every one was a winner, except maybe the Klingons who might not have liked the punishment. After all they had no legal leg to stand on so to speak. Their vessel did voilate the Neutral Zone (a possible act of war), their vessel did fire upon a Federation vessel (another act of war), it's crew did murder Federation citizens etc...
Though the Klingon Ambassador did have to eat his words a few years later. "There can be no peace as long as Kirk lives"