I don't see Mac coming back to 49ers next season. A team will trade for him in the off season.
I think it depends on how much the Niners value Mac especially considering the injury history of Purdy. If the Niners plan on Purdy to be the starter for the future they may "overpay" for a second string QB like Mac because the odds of Purdy making through an entire season are slim. It's a lot like Tua, if I'm Miami, I would have invested in a much better backup and overpaid if I had to because you never know when Tua's about to miss three to four games. Purdy is a lot like that. I also think the Niners will allow Mac some say so in any trade. I know Mac doesn't want to get traded back into a bad situation like the Patriots were, and I think Shanahan and Mac's relationship is too close for them to do that to him.