As good as the current answers are, they miss something, which is natural.
Are you able to pivot your thesis into an area you are interested in? It doesn't have to be a large move, just enough for it to be more interesting. My mom got a Masters in Art History (not the same as a PhD, I know), and she wrote a paper not on the "classics", but rather historical and current Native American Indian art. In her case, she spent time camping on various American Indian reservations and interacting directly with the cultures she was writing about for days or weeks at a time.
No only did she get some great information, but it also helped her relax and avoid burnout. I'm not saying this will work for your topic, but it goes to show that some topics aren't relegated to just a lab or a library. Yes, she could have spent those same weeks in a library, getting her research material from books, but instead she went out and did the research in person. It cost a fair amount of money and I don't remember if she had a job to take time off from, but she absolutely loved it.
So what do you want? This is about you, not someone else's expectations of you. FYI, my mom did this degree for her own interests, not because it would necessarily help her career. I'm sure that was part of it, but she was in her 50's (maybe 60's, I don't remember) when she finished her degree, after decades of starts and stops along the way.
Once you get your mental health addressed, prove to your "haters" they are wrong about you. One of the best ego boosts is to see those same negative people come around to your side. That doesn't mean you should accept their pandering, but enjoy the fact that you were right after all.
BTW, PhDs are supposed to be hard. It's to weed out people who think they can't do it. When you prove that you think you can do it by overcoming the difficulties of a PhD, you get the rewards of that hard work. One of those things is that what used to be hard may no longer be difficult for you. Another is self doubt about your abilities goes away. All of that might not happen just because you get the diploma, but it will eventually, as long as you don't compare yourself to others. The key detail is that you have to think you can do it before you can actually do it.
Too often, even after they get a degree, people will compare themselves to those who are leaders in their field and think they are nothing compared to them. Well, likely that's true, but only because they have vast amounts of experience you don't yet have, which is only because you are newer to the field and haven't the time to gain the experience they do. How are people with brand new degrees supposed to compete with those with 20+ years of experience? By patience and gaining those 20+ of experience themselves. Those leaders didn't become leaders overnight.
Also, those leaders were likely once in your shoes, comparing themselves to people who had vast amounts of experience. They were also likely where you are right now, thinking they can't make it to the end of the PhD, being stressed, and thinking of quitting. But they didn't quit, they kept on until they finished. If you must compare yourself to these people, use them as positive influence. "If they can do it, so can I."
Just like you need to, they took care of themselves and finished their PhD. They gathered themselves up and thought, "I got this." Not because they knew they'd become leaders, but because it's what they wanted to do.
So I ask again: what do you want? What is it that you really want, with the core of your soul/heart/being/(whatever you want to call it)? Do you want to quit or do you want to finish? Either answer is OK, but are you going to regret it later in life?
You don't even have to answer this right away. Take a couple days, a week, or a month to get your head straight and your body recovered. Just don't take more time than you need. Waiting too long will help you make the easy answer of quitting. The sooner you answer, the more likely it's going to be your right answer, the one you can live with for the rest of your life.
Even if you quit, rest assured that the time you spent working was not wasted. You found your limit, stretched it, found new limits, and decided to stop before you broke. There is no shame in admitting that you set a goal you aren't ready to reach. Maybe you pick things back up later. Maybe you don't.
Yes, I wrote most of this Answer as if you need to finish your degree. I did it to show support for you in your goal of completing this degree, but if you can't finish it, know that I support that decision, too. This is your life, your goals, your decision. What I think about it shouldn't matter to you. I can only give suggestions. I can't do it for you. You do what you need to do and if people don't agree, accept their criticism with the same amount of respect it deserves, but keep doing what you need to do to feel good about yourself. That's all anyone really can do.
This is an academic site, so the "of course" answer is going to be to finish the PhD, but the real answer is: what do you really want to do?
Good luck and I hope you enjoy the journey ahead of you!