I've seen a couple people at our gym have a very similar issue, and I remember we were Googling the issue and found out it was pretty common.
The first thing they did was making sure their set-up for the squat was symmetrical. Middle, of the bar, feet at the same angle, etcetera
Two, making sure the execution was symmetrical. Knee tracking, etcetera
Three, addressing any flexibility imbalances from the ankles to the hips.
People might start talking about limb lengths, hip cups, and some other bullshit-- I know I did. But, for them they really focused on consciously executing their squat with perfection, keep the hips level throughout the squat, and within a few months time it was a forgotten issue.