Leek moth attack on garlic and onions
This could be Leek moth. The caterpillar stage can also attack garlic and onions. This is a new pest and difficult to control. I suggest you destroy and remove any of the pupae you see and infested plants. The only way to protect fully is by putting a fleece over the plants but it sounds a bit late for that. I suggest you do that next year to prevent the problem.
We are also testing a Leek moth trap, which should be ready for next season. For this year remove as many infested plants and bulbs as possible and destroy old crop at the end of the year. Do not leave old plants on the plot.
Hope this helps.