Often when the knee moves inward during a lower limb exercise, it either follows weak hip stabilizers or foot arch collapse.
Feet tend to flatten when the weight we carry increases. As a chain reaction, the knee moves inward. This pattern may lead to various knee pain, like iliotibial band syndrome, patellofemoral pain, ligament injury - ACL or MCL.
The foot muscles are intended to move the foot and preserve the arched structure. Strengthening the foot and preserving the deep plantar fascia are key components here.
The deep fascia preserves the arch whenever we extend our toes.
When performing a heavy squat or lunge, first extend the toes, then slowly return the toes to the floor. This will preserve the arch.