The vas deferens following this seemingly odd path is just a result of the natural course of our evolution. Millions of generations ago, our ancestors were quadrapedal (walked on all four limbs). Similar to if you were to crawl on your hands and knees today. In this position the pelvis is rotated forward by ~90 degrees from its position in humans currently. The natural position of the testicles in this position would be to hang straight down due to gravity. Which means the vas deferens would have a straight path up in front of the pubic bone.
Generation after generation, our taller and more upright ancestors were able to survive slightly better than their less upright siblings. Meaning that many of the more quadrapedal siblings died while their more upright siblings survived and reproduced. This process has continued for millions of generations, leading to our current homonid upright posture.
The path of the vas deferens was established long before our ancestors ever began this slow transition toward standing vertically. So the vas deferens still follows the same path that it always has, but now our testicles have moved down because we stand vertically. Which leaves the vas deferens with its seemingly odd route of going forward over the pubic bone and then down to the testicles.
Evolution is a continuous incremental process over the course of millions of generations. There has been no point at which the vas deferens could be 'unplugged' and rerouted around the pubic bone. So it now just loops in front of the pubic bone and then to its destination.
Richard Dawkins used the word "mistake" in his description because there is not necessarily an advantage to that particular route of the vas deferens(there may even be small disadvantages), but there was a LARGE advantage to our ancestors standing upright. So as we evolved to stand more upright, the testicles moved down appropriately and the vas deferens just ended up where it is, simply because that's where it always has been. Not really a mistake, just the way it worked out.
Hope this is helpful.