Actually, you’d be right. The trick here is your “Joint Target Location”. Make sure that stays further ahead in the Y value than the knee ever does and it will keep doing that the correct way.
The green object is the Joint Target Location