Imagine how Starfleet would've reacted if it had been the Enterprise destroyed and 400 crewman dead. With Kirk making it back with himself and less than forty crewman.
And blamed this on some weird lifeform that no one has ever encountered before and he has no evidence for whatsoever.
Kirk would never have commanded a starship again.
Remember, courtmartial for a Captain losing his ship was standard procedure for Starfleet. They courtmartialed Picard for losing Stargazer when it was clearly a case of surprise attack and Picard had to pull a brilliant move just get out with their lives.
Well, to be fair, the use of the term 'court martial' doesn't automatically mean it's a criminal trial or that the Captain is suspected of wrongdoing. It's just a standard way to get the circumstances of that ship's destruction, made part of the official record.