Let me preface this by saying that I am in no way a great squatter.
So, your form is pretty good on 1 and 2. As you fatigue, your form will break down. It is natural.
Most important thing here for a beginner? Depth. You're doing very well in that department. If you started light and are progressing slowly, you will have good success. (I don't know your whole training story, but it appears that you did this part right.)
One thing that helps me is my set up. Keep refining it and experimenting to see what works for you. Foot, head, bar, and hand position will all help determine your depth, and how your joints track.
It could be a muscle weakness, but you are young with respect to your training age. My call is that this "knee problem" will probably sort itself out naturally as you progress.
You should also do a small search on "cues." Find 2 or three that work for you, and focus on them as you go through your lift. Do it until those things become second nature, and then evaluate your progress, and repeat. Good ones for me have been:
-Feet out at 45 degrees.
-Break at knees and hips at same time.
-Keep weight on heels.
-Feel "rebound" when your hamstrings and calves meet. (Paused reps are great for learning to feel this.)