How to let go of perfection
You are pointlessly engaging in self-sabotage if you insist on perfection because that insistence is by definition imperfect. You may not really be the perfectionist you think you are.
You should recognize that there are better pathways to achievement. You should work on redefining what you mean by perfection and the achievement thereof. Here is a hint: being exact is impossible and hence a pointless goal. Precision need only be good enough and no more. It is a waste of time perfecting a component to 20 decimal places of accuracy if only five are required.
You want your goals to make sense and one of the primary measures should be your happiness.
People succeed better when success is engineered for them. If you must, you can engineer success for yourself. Do so by recognizing goals that make sense and strategies to get there that also make sense. One big tactic is to break larger goals into smaller ones so that the path forward is almost always filled with success. Pat yourself on the back for making any forward progress at all and be gentle on yourself when you slip back.
Finishing ahead of schedule is much more satisfying than finishing late. Make this happen by setting realistic goals and giving yourself plenty of time to achieve them. It will do no harm to finish early and start the next task sooner than scheduled.
If you are working harder than you should and achieving less than you should and feeling unhappy about it then your notion of the perfection you seek is broken.
Finally, recognize that at some point the harder you try to perfect something the less perfect it becomes. You need to know when to reward yourself for finishing and move on to the next goal.
Observe that a score of 90% is an A is your courses, and that this is a general and longstanding recognition that all students (humans) make errors and can still be considered "excellent". Recognize that this applies to life generally.
Change what you believe about "perfection". (By the way, the attempt to be perfect is itself imperfect. It is a flaw, not a strength, when applied to a person's total self.)
Realise ASAP you're striving for an inconceivable metric
Embrace mediocrity. Nobody can maintain 100% satisfaction all the time. It will destroy you. Sometimes, "good enough" is enough.
Learn that imperfection is perfection