To answer the OP's question, if San Fran wins out and Seattle loses, they both wind up with 12-4 records. Thus you go to the NFL's two-team division tiebreaks. The first thing on that tiebreak is head-to-head. Seattle and San Fran split, so this tiebreak is indecisive. Since both teams are in the same division, the second tie-break is division record. Seattle would be 3-3 and San Fran would be 4-2.
Result: San Fran wins the Division.
This was known as soon as we failed to defeat the Niners a couple of weeks ago (and one reason I am still upset about that loss). Because dear ol' Goodell backloaded our division games, it means ever since that the only way for San Fran and Seattle to be tied would automatically give the division tiebreak to San Fran.
As a bit of interest, I note that this is almost exactly the situation that applied last year except it was San Fran that was hanging on for dear life to the division crown, and it was Seattle that was going on a five game tear to try to take it away. The scenarios were almost the same too. Just as this year, it's Win and Division for Seattle (that or a San Fran loss), last year it was the reverse. Had San Fran lost to Arizona last year on their final game, Seattle's win vs St Louis would have given Seattle the division and the #2 seed.