If you have an issue with your animal actively eating dirt and substrate (something usually caused by the absence of a vitamin or mineral in the diet), then you should obviously not house them in an enclosure with substrate as excessive ingestion of substrate will increase the chances of impaction issues. Most chameleons do not actively eat dirt and the small amounts they may ingest during feeding should pass without a problem.
I personally feel that fully planted enclosures with an organic soil substrate and drainage layer is a very useful addition to chameleon enclosures. It helps buffer the humidity, prevent standing water in the bottom of the enclosure, makes your plants healthier (and thus the rest of the enclosure better for the cham), etc.
Regarding the concern of parasites, healthy chameleons (and other host organisms) generally live with internal parasites without a problem as they are at a balance. While recently imported or otherwise compromised animals fighting acclimation, stress and illness may need to be deparasitized, healthy animals typically do not, although annual deparasitizing treatment is helpful as a safety measure. Our captive chameleons are exposed to sources of parasites from their commercially produced feeders, wild collected feeders, etc., so the risk of parasite exposure from a naturally planted terrarium is not a novel risk and in my opinion, its risks are outweighed by its benefits.
Chris