This can be a common sight on a home that’s 20-30 years old with original windows and frames.
This deterioration and mold buildup looks like it could be caused by condensation on the wood frame in the cold weather, coming from higher humidity in the house. Worst place for this may be in the bathroom, where frequent shower moisture is present.
If left unattended, the mold builds up, the paint breaks down, and the wood frame can rot and fall apart. If it reaches that point, a new window unit is likely needed.
Is this true that if it reaches that point the whole window needs to be replaced? What about replacing the frame? Well, yes. There are too many obstacles in trying to replace parts of a frame, the time and work needed would put the price too high, not to mention the risk of substandard results. A window can be considered like one part, that can be removed and replaced as a unit, if replacement became necessary.
The cause of the problem, in this case, appears to be moisture penetration and paint deterioration from the humidity in the home. There also could be a draft of cold air through the window frame from the outside creating a cold area which attracts excessive condensation.  This may be due to gaps in the caulking or other weather seals on the outside of the window frame. There could also be a gap in the insulation inside the wall creating a small cold spot. A closer look may reveal what else may be involved.
This needs to be explored, and if so, the issue found needs to be repaired. I would make a judgement call at the time as to what can and can’t be done. If weather and conditions permit, a quick caulking patchup even in winter could be feasible on the outside. If too much moisture is a problem, especially if its a bathroom, maybe ventilation needs to be improved so the areas dry out more quickly on the inside.
The trick is to catch it before it goes too far, then with early intervention, more economical repairs are likely possible.
The fix, in this case, since this frame appears salvageable, is to check for possible causes mentioned above, clean it up, possibly replace the inside window trim, seal it, and repaint it with a good quality moisture resistant paint.