Yeah, I think Shanahan played this about as good as he could. There were a lot of things at play here, and the Mahomes factor is always in play.
At the end of the first half, you either choose the:
"I need to try and score as many points as I can to combat Mahomes"
"I need to make sure I don't give him back the ball here, especially since I get the ball the start of the 3rd quarter."
Both options are essentially correct. I do agree with you that option one should have been the play, mainly because your D was shutting us down, and even 3 points there PLUS the second half kickoff would have given him so many more options.
As far as the 4th quarter goes, Shanahan was in no-man's land there. His team scored enough to get the lead in the 3rd quarter, but didn't score enough to really put it out of reach for the Chiefs.
So really, in the 4th quarter he HAD to still mix it up as far as I was concerned. The Chiefs were selling out HARD to stop the run, and Shanahan knew that. Some of the passing situations were on Garoppolo, but how can you blame Shanahan for going to him - he had been incredibly efficient all game.
And to be honest, the Chiefs defense DID make some plays down the stretch. And made enough to give Mahomes an opening, which is all he needs. The other factor here is that the design of Reid's offense means pass rushers for the opposing D are rushing A LOT for three quarters, AND the speed of our wide-outs means those corners and safeties are chasing those guys around all day.
Those two factors helps to explain why the Chiefs offense has that ability to come back. They are literally built for this and also built for tiring out that defense for later in the game.
Shanahan and the niners almost played the perfect game.