From above, knee muscles attach to the thigh or the pelvis. From below, knee muscles attach to the fibula, tibia, and also to the calcaneus or heel bone.
As such the knees may be affected by the heel and foot and also by the hip and pelvis. Put another way, muscle problems within the foot or hip can affect the knee and vice versa.
The thigh consists of a single bone, the femur. The lower leg consists of two bones, the tibia and the fibular. The tibia is the larger of these two bones and connects directly to the femur at the knee joint. The fibula is smaller and non-weight bearing and is positioned to the outside of the tibia. It has some slight ability to move relative to the tibia, mainly sliding up and down.
When the knee is bent the lower leg can rotate relative to the thigh. This is why in poses like hero the foot can move to the outside of the thigh and why in bent knee poses like lotus or janu sirsasana c the foot can move towards the inside of the thigh.
When the knee is straight, the lower leg and thigh rotate together as one unit.
The rotational ability of the knee might account for, in part, the triple head design of the vastus muscles , with each head being more active at various degrees of rotation in weight bearing bent knee positions.
(vastus lateralis, vastus intermedius, vastus medius, each part of the quadriceps muscle)
In terms of rotating the shin relative to the thigh, posterior thigh and lateral hip muscles that attach to the fibular and outer tibia are responsible for rotating the shin outwards while posterior thigh and medial hip muscles are responsible for rotating the shin inwards.
In straight leg standing on one leg positions, focusing on the standing leg, the knee rotators may work against each other and the quadriceps to help stabilize the knee.
Three muscles that cross the hip joint and attach to the inner edge of the tibia are the sartorius, gracilis and biceps femoris long head. Each of these muscles attaches to a prominent landmark of the pelvis. The sartorius attaches to the ASIC, the gracilis attaches near the pubic bone and the semi-tendinosus to the ischial tuberosity.
(The gracilis attaches to the ischiopuboramus near the pubic bone.)
Depending on the amount of bend in the hip, either of these muscles can come into play to internally rotate the shin or to stabilize it against external rotation.
Another muscle that attaches to the inner edge of the tibia, just below the knee, is the popliteus. The bulk of this muscle is located on the lower leg side of the knee. It's tendon crosses the back of the knee to attach to the outside of the thigh just above the knee joint.
Unlike the other three muscles, this is a single joint muscle. It only works on the knee joint. It may be important in helping to regulate joint capsule tension. The other three muscles attach further away from the joint capsule and so in this regard may be less important.
One other muscle that attaches to the inner aspect of the tibia is the semimembranosus. This muscle, like the popliteus, attaches close to the knee joint capsule. Relative to the other muscles, particularly semitendinosus, it is also positioned closer to the bone. So it too may be important in regulating joint capsule tension (and thus inter-joint fluid pressure.)
Three muscles that cross the hip joint and attach to the outside of the lower leg are the biceps femoris long head, some fibers of the gluteus maximus and the tensor fasciae latae.
These latter two muscles attach to the tibia via the iliotibial tract. The former muscle attaches to the fibula.
As with internal rotation, depending on the amount of bend in the hip, either the glute maximus or the tensor fasciae latae can come into play to help externally rotate the shin relative to the thigh.
From a rotationally stable knee joint that is supporting the weight of the body, these five shin rotating muscles (glute max, TFL, Sartorius, Gracilis, semi-tendinosus) could be used to help control pelvic positioning relative to the thigh.
If the leg is free but the knee is stable and strong (and particularly if the knee is straight), then the TFL and Sartorius may be used as accessory hip flexor muscles.
A single joint muscle that attaches to the outside of the lower leg is the biceps femoris short head. This muscle attaches to most of the length of the back of the femur, stopping just short of an attachment point for the gluteus maximus. (Some fibers of the gluteus maximus attach directly to the thigh while others attach to the iliotibial tract. It may be worth thinking of these as separate muscles.) This muscle blends with the long head prior to inserting into the fibula.
Working from the heel upwards, the soleus muscle attaches from the calcanus or heel bone to the tibia and fibula. When active it can create a downwards pull on the fibula, stabilizing it against an upwards pull, say from either of the two biceps femoris muscles.
The gastrocnemius attaches from the heel to the thigh just above the knee joint. It's twin tendons pass between those of the hamstring muscles before attaching to the femur. When the knee is straight, the tendons of the hamstrings and gastrocnemius press against each other so that both become more tense.
So calf control (and heel control) may be an important consideration when working on knee strength, particularly in straight leg positions.
Of the single joint muscles above the knee, the biceps femoris short head is perhaps the most critical, particularly when stabilizing the knee. If it has problems, the biceps femoris long head, glute max or tensor fascia latae may stand in for it which could lead to hip stability and hip control problems.
For myself the left biceps femoris short head has been problematic. It may have led to hamstring pain in seated forward bends (particularly in left leg straight asymetrical forward bends where I'm trying to lift my hands). And it may be one of the causes of hip pain in standing forward bends with the left leg forwards (triangle or front triangle) or one leg balance poses on the left leg.
Comparing my left leg to my right I notice an absence of tension at the outer back of the thigh and the outer rear hamstring tendon. Trying to adjust hip position while trying to activate this muscle helps a little but it feels more forced. And so even as I write this one possibility is to make sure that the heel is stable (while standing), make sure the outer gastrocnemius is active, then work at activating the biceps femoris short head.