The glute medius and minimus help abduct the hip and act as a stabilizer for the pelvis, allowing the glute max to perform the dynamic portions of a movement, like when you're doing something on one leg. And don't say you're not into unilateral work. Otherwise you'd never walk, sprint, or lunge.
Because the glute medius is responsible for hip abduction, it needs to be strong in order to hold proper knee tracking during the squat. So if your ankle flexibility isn't the cause of your valgus collapse, your glute medius likely isn't strong enough to hold proper knee position. This will get it stronger.
Perform a split squat, rear leg on a bench behind you, then only come about 3/4ths of the way up. Hold that position for 3 seconds before lowering again. You can use a dumbbell or bodyweight only. That all depends on your level of strength/development. However, I'd recommend using progressive overload and working your way up to using the heaviest dumbbell you can while maintaining great form. Do 3 sets of 8 reps with a 3 second isometric hold.