I think Spock was big enough to take some good-natured kidding.
The real problem with the ending was the television-related need for it to be upbeat after four men just died. If Kirk is a realistic character, his happy-talk with Spock and McCoy is a total facade here. He has to explain his losses to the Admiralty and probably write letters to four next of kin.
"Obsession" is another offender in this regard. "City on the Edge," "Catspaw," and "A Private Little War" got it right.