Well yea there was too much to gain for the Marines there. Ace was to be used as an example for the pirate world. He's a symbol.
So what you're asking is Garp should have fought the top brass to just lock him up instead of executing him? Breaking him out is out of question.
This is such moral bankruptcy it is idiotic. Garp already defied them and let countless babies around the world get slaughtered via keeping Ace secret. If the bastard was willing to break out his son, he should have done the same for Ace, or sold Ace to the dogs ages ago and at least saved some innocent babys from his fellow monstrous Marines.
Garp lost ANY claim to righteousness and not being a dogshit person when he sprung Dragon from jail and did not leave with him / make a stand then and there. The fact he remaiend a Marine after God Valley where he kept his goddamn memory about one of his World Government bosses literally being a Spider Demon piloted by the Devil is the icing on the cake.
FUCK any Garp defenders I do not care.