The branches have the bark cut through encircling the limb so that the limb dies.
Insect Destroying Mesquite Tree
Certified GKH Gardening Expert
There are several things you can do about controlling insects. There are many natural remedies, and synthetic. I like neem oil, rosemary oil, and cinnamon extract for this purpose.
Here is a link that will help: https://www.gardeningknowhow.com/special/organic/natural-home-pesticides-organic-garden-pest-control.htm