I have always had them. Even ripping out the kitchen and replacing it didn't help - they still kept coming back. Worms/maggots in the summer and the moths in the autumn.
Recently, I've managed to get some sort of control over it. Opened packets are now decanted into glass jars which stand decoratively around the kitchen. You can see how much of each item (rice, flour, breadcrums, porridge oats, nuts, etc) you've got, and you can see if anything is crawling about. But mainly, as they are sealed with a rubber ring inside the lid, there is no danger of the infection spreading.
The worms are, in fact, quite nutritious, but I've never been able to eat them.
Having said that, I have never in my life seen a cockroach, even though I have lived in quite Southern climes.