I count 16 consecutive winning seasons for the Niners, beginning with 1983 and ending with 1998. If you throw out the 1982 strike year (when the Niners went 3-6), it would be 17.
Anyway, it was Montana for only the first 8 years with Walsh as HC for the first six and Seifert for Montana's last two. The last 8 years was Steve Young, under Seifert for six, then Mariucci for his last two.
The current system of player free-agency under a salary cap began in 1993, so the Niners had some advantages (that the Pats don't) for the first 11 years of that streak.
AFAIK, Indy's 9 consecutive winning seasons with Manning is the second-longest streak since 1993. However, other franchises have had very long periods of relative success interrupted by a single losing season here and there - e.g., the Broncos had 20 of 24 non-losing seasons from 1993 through 2016, 15 of those above .500.