You said: The defense had clearly shown they weren't very good by that point in the game
Which IMO shows they will score wether FG or TD. Maybe SF thought they would stop and then we could March it down the field.
Missed tackles all over, no pressure on QB, lack of running, missing wide open receivers, receivers dropping passes, blown coverage, NW lots of YAC, might be more things to look at than 2 timeouts used to try to score again