given that you are suffering from actual pain, i would look into seeing a medical profressional. I would take a look into some psoas/hipflexor stretching techiniques. Theres many different avenues to go down through different assements for hip internal rotation to glute activations.
Right now, i would see if the standard half kneeling hip flexor stretch causes any pain. if not, i would do some bridging exercises to draw blood into the glutes. when you bring your hips off the floor squeeze the HELL out of ur glutes and then follow it with hip flexor stretching - if there is no pain. go back and forth a few times and try your squats or deads.
this is no away intened to tell you what your definitive issue is, but could be a starting point. given you are experiencing pain i would see a medical profession.