I've never found a stainable glue, but in working with musical instruments I can say that the hide glue is as good as it gets.
For small cracks, I put a tiny amount in the crack to seal the open wood pores (these will absorb too much stain if not sealed). If more gluing is needed, I do it after staining so the stain goes under the glue.
For chips, I try to replace the wood. On new projects I save shavings and removed bits of wood particularly for this. With restoration projects, I would try to get the wood from someplace unnoticeable in the finished product (Under butt plates, or from inside patch boxes). This works for pin holes as well, just cut a sliver that you can shape and tap into the hole and smooth off (glueing only the very bottom of the hole, as the glue will get pushed up and out)
It seems that the trick is to use less glue than you think you need, and not not get any on the stainable surface if you can help it. Hide glue is good for this, because it is very strong, and you can apply it to only the inside of cracks, and mating surfaces of chips. True hide glue, the kind that has to go on hot, is also nice because it can be completely removed from wood pores with hot water and a little effort. This allows the repair to be undone on old collectibles at a later date if needed.
Anything small enough to be invisibly filled with dust and glue mixed, will likely disappear by simply adding some paste wax.
I've done very little repair work on guns, but this method has worked on several violins that I have repaired.