I'm a young math student. And I live with the effort of always wanting to understand everything I study, in mathematics. This means that for every thing I face I must always understand every single demonstration, studying the basics every time if I don't remember them. And this makes it impossible for me to prepare the exams, because I can't go on, I fix myself on wanting to derive by myself a theorem and I lose days in it. And so I ask mathematicians if it is always necessary to be able to prove everything, or we must accept what the theorems say and give it for good. If possible I also ask you some advices to help me study, knowing my problem.
Concentrate on doing the homework problems. They are most important for developing your skills.
Your approach is not time efficient. You need to learn things at a surface level and then come back and learn it deeper. The human brain is not a computer. We are imperfect animals and learn by starting a groove and deepening it over time AND making connections over time to previous knowledge. If you try to do it perfect immediately, you are fighting nature.
Keep a notebook and use it for a parking lot. Record questions, thoughts, ideas as you study something. Often this will set your mind at ease as the concern is recorded at least. Often later on, you will realize the answer or resolve the question. But it won't have stopped you from advancing in the material. Where it does not, at least you have an organized list of questions to discuss with your teacher.
You will never know everything in mathematics. One place you could read about this is Bill Thurston's 'On Proof and Progress in Mathematics'. He gives a (slightly fictitious) list of many, many ways of understanding the concept of derivative, some of which will almost certainly be beyond you at this point.
It sounds like you need to recognise that your personality is making your studies difficult, and find ways of dealing with that. There is nothing wrong with wanting to understand everything: mathematicians would generally encourage that, and many wish their students took more of that attitude. But you should perhaps try to remember that you don't necessarily need to understand everything now. If you have an exam coming up, you should change your purpose temporarily from 'understanding mathematics' to 'learning what you can to get enough marks in the exam'.
It is also worth considering that the process of going through the motions of something, even if you don't understand it, may in fact help you to come to understand it. As you do examples, you may spot the pattern that you are not noticing from the general description.