Smith was the biggest benefactor of Harbaugh. Yes, he lost his job when he got a concussion, but he has been serviceable since the first day that Harbaugh showed up. As you said he has gone on to continue that success but before Harbaugh showed up he was a hot mess. Not entirely his fault, clearly in a decent system he can have some success, but he lacked confidence in his early years.
Kapernick won the job over Smith because Kap could score touchdowns. The defense had to account to for him almost as a running back. It would take a linebacker out of coverage making receivers more open. If they went into coverage he ran all over them. And he was better than any running back when running.
His issue has always been disguised coverages. He will make a pre-snap read and he cannot adjust when the defense moves out of that pre-snap position. The Seahawks defense caught onto his inability to adjust his pre-snap read and once the other defenses caught onto this he was far less effective.
Many 49er faithful now feel we should have never let Smith go. But the reality is Smith was really good at driving us down the field and kicking a crapload of field goals. He seemed to struggle with red zone efficiency. The field goals worked when we have a good defense, but Harbaugh saw touchdowns with Kapernick he couldn't get with Smith and traded him. I think Harbaugh did the right thing.
The big mistake was getting rid of Harbaugh.