Personally, i do not believe in quitting the Dharma and I am well aware of all the challenges that taking the path of Dharma has. It has to do more with self created obstacles, wrong perceptions and negative habituations that have been accumulated for many lifetimes. To overcome so much negativities, it is not going to be an easy or straightforward journey. Some people who are not used to difficulties may give up, or if the Dharma practice touched a sensitive place in their hearts and minds and remind them of something that they do not wish to be reminded. Definitely a difficult journey, but to not go through it is more difficult in the long run as there will be more suffering, pain and regret.
To me, to stop myself from quitting, I question myself constantly and constantly align my motivation so that i am not here to gain some sort of company or some sense of belonging or to get something out of my Lama and Dharma center, apart from the Dharma as people usually quit if they have ulterior motive to join the Dharma. Whenever i get upset when someone else criticize me or when i feel helpless, i question myself again why am i upset and realize that its just a misaligned motivation until my mind becomes stable and determined to stay to Dharma no matter what happens or no matter how painful things or situations turn out to be. That is how i kind of remove or challenge my thoughts of quitting.
If i do know someone in my Dharma community who wants to quit, I do hear them out as there is always a reason to trigger people to quit. sometimes it could be an imaginary problem, a misunderstanding of sorts, or it could be that the person has attitude problems and then explain to them and encourage them to not give up and give things another chance. I have seen and heard of people berating people who want to quit, and its not exactly a kind thing to do. Advice, support and care should be given to those who need it and wrathful action also has its place in such situations at the same time.
Some people quit the Dharma because their negative karma stacked up to the point where it cuts them off from Dharma so that they dont create more negative karma. When those leave, it would kinda feel natural in some way, but at least, they have the imprints and they might rejoin Dharma again when the conditions are right.