Understanding primes is fundamental to an understanding of number theory.
Number theory itself is pure mathematics, which concerns itself with abstract concepts, so the immediate motivation is one of exercising our intelligence and playing with the puzzles that we discover. "Intellectual masturbation", to use your classy phrase, is fun. You should try it sometime.
But of course, in turn number theory underpins many other areas of mathematics, including for example the discrete mathematics used in the development of computer algorithms, not to mention the numerical analysis we use in engineering.
You seem to be making the mistake of thinking that research is best directed according to practical goals. Actually, it is more time effective to solve hard and fundamental problems that have general usefulness in the field than it is to pick off application specific tasks that won't have any relevance beyond next year.
Of course, there has to be a balance here between general and specific. But since the number of people doing pure research is such a small fraction of the population, it is really up to you to justify why we don't have more people studying these matters.