Seeing as it was half used and then not touched in 2-3 weeks, I'd say that it was contaminated and not caused by NLS. This is food in there, so there is no surprise that if it gets moist enough, bugs would love it and breed there. Do you put your fingers into the jar when they are wet? You don't want any moisture in with the pellets.
Never happened to me with any of my dry fish food. I purchased dry dog food that was contaminated with bugs once at the store but the owner didn't tell me. Not fun, they got into all my dry goods in storage and I had to throw everything out.
If you are getting them into multiple containers at different times after throwing them out,you have them someplace else in the house and they are cross populating. It's not the NLS pellets if you throw out the container and it keeps happening.