Don,
What is amazing about life is the complex overlapping ecosystems. That is not merely a woodpecker on a tree.
It’s a woodpecker on a particular tree with lichen or some other plant and for sure myriads of nesting insects and other life feeding on them.
The bird is not just a flying animal, but each surface, inside and outside its body, has a balanced community of microbes unique to that region and commanding control systems within bird.
Likely as not, particular gut bacteria influence the woodpecker’s selection choose of beetles to optimize the survival of that microbe!
Asher