No way to know how long it will last. Might be 50k, might be 50.
New fluid will help, but obviously it won't solve the problem. And it will still be a gamble every time you drive it. Make sure your never outside the towing range of your AAA membership....
Whatever you think it's worth (I won't get into that, the market is crazy right now), it will be worth a LOT less with a known major problem like that.
Look at Impreza transmissions. 3.9 is a very common ratio for the Impreza/OBS in that vintage. They will likely have a slightly taller 5th gear than the heavier Legacy, but it's a pretty small change.
Facebook marketplace and brand-specific groups are a great place to buy a transmission. I bought 2 Turbo (FXT and OBXT) 4.444 manual transmissions for $150 through a local group. One has completely unknown history, but still! I bet with a little digging, you could find a nice local transmission for 300 or less. Sure, it's a pain of a job, but if the car is in otherwise good condition, you will add thousands of dollars to its resale value. That's easy math if you ask me. You could probably find a shadetree mechanic doing side work in his garage and pay him to do it, and still come out way ahead.