I had something similar, a three day bikepacking trip brought on some pretty serious pain. Best guess is a combination of 30 hrs riding and no stretching/recovery caused extreme tightness in the quads, and knee tracking wasn’t perfect as I avoided rubbing the frame bag.
It went away very quickly in the week after the trip but would start to flare up again after riding (despite little to no pain during). Ended up taking a few weeks off committing to rolling and stretching those three main muscle groups (quads, hamstring, glutes). Finally back to a normal where I can start seriously training without worrying about flare ups.
Foam roller is the best, keep movements on it slow and work through your range of motion in the knee while on it. With winter arriving I have also found that a heat wrap before exercise has helped it feel good and loose.