Do you have any animals that you feed wax worms to? Because those look a lot like what I found when I opened an old can of wax worms... a moth fluttered out! Perhaps some escaped/you dropped some accidentally? I'm probably wrong but it's a thought. You said the bag was left open, perhaps some larvae had made their way inside to pupate. Don't think they would really bother the snake much though, in the wild they'd encounter all sorts of invertebrates every day.