There are many studies that have used RNAi against the plant parasite M. incognita. The fundamental idea is that RNAi is directed against one of the vital genes of this nematode. Since, RNAi causes downregulation of the target gene, the nematode dies (or becomes ineffective in infecting) because of the loss of function of these important genes. As you might know about the process of RNAi, dsRNA (or hairpins) are cleaved by Dicer and the small single stranded RNA products, called siRNAs, associate with Argonaute proteins to form RISC (RNA induced silencing complex). The RISC will cleave RNAs complementary to the siRNA.
If you see any of these articles you will notice that the dsRNA is not injected into the nematode; it is expressed in the plant. Nematodes (such as this one and C.elegans in which it is quite well studied) can take up dsRNA from the environment via the RNA transporters present in their cell membranes (See this post).
Now, coming to your question on "Why do RNAi pathway proteins exist in the nematode when they can cause them harm?"
endo-siRNA and miRNA mediated silencing pathways have critical roles in the nematode development and other miscellaneous functions (See this review). As you already know, RNAi can also serve as a defence against dsRNA viruses.
It is us, humans, who have exploited this pathway to develop tools for molecular biology and for targeting parasitic organisms. There is certainly a likelihood that the host plant may express the dsRNA against the nematode during the course of the evolution of its anti-parasitic defence system (it is however not the case now). Not just RNAi, there are many other examples of endogenous pathways of a pathogen being exploited to kill the pathogen.