Exercises for knee pain can help to prevent injuries and speed up recovery. To work properly, the leg needs three things, strength (power and endurance), movement (joint range and muscle length) and stability (control, balance and proprioception). Lack of any of them can cause problems and pain.
Any knee injury/problem will almost certainly affect the leg muscles. The main problems that develop are:
1) Tightness: which limits how much the leg can move and
2) Weakness: which limits either the instantaneous strength of the muscle or the endurance (how long the muscle can work for)
Tightness and weakness leads to muscle imbalance where some muscles don’t work hard enough and others try to work extra hard to compensate.