Not just guns for this problem, all manner of things which vibrate. I work a lot with doublebasses and one of the more common problems is buzzing, which can emanate from any number of sources such as opened seams (seasonal shrinkage related), loose interior repairs, strings running into irregularities on the fingerboard etc. I have a mental checklist I run through whenever I'm asked to cure a buzz and right at the top of the list is loose screws on accessories, especially the tuners. Retaining screws going through brass into wood come loose surprisingly quickly. Doesn't matter how tightly they were installed, within a year or two of playing they can back out a full turn or more, allowing the thing they were holding down to vibrate against the wood. Same for the retaining bolts on tuner gears - this is metal-on-metal, a gear wheel with a square hole going onto the square end of the tuner shaft around which the string wraps. I've seen these backed out several turns, almost to the point of flying off the instrument, with the gear wheel flopping around and the player blissfully unaware of the impending explosion.
A dab of Loc-tite works wonders on those. But for the screws going into wood it's not useful. There I use a dab of normal PVA, or carpenter's glue. The screws will still unscrew when necessary, but the slight improvement in grab offered with the glue makes for enough friction that they won't back out for a lot more years, and slightly toughens the wood in the hole such that there's less risk of stripping when someone tightens the screws.
Seems fairly obvious that a gun will be if anything more prone to things coming loose. Scope mounts, stock screws, anything bolted together should eventually come loose with enough vibration cycles. Same with bicycles. When I was a mechanic in the first half of the 1980's one of the most common problems was bikes basically disassembling themselves, as their owners didn't seem to grasp that bumping down the road created a perfect set of vibrations with which to loosen practically every part on the machine. Seems to me an odd sort of mindset, that loosening bolts is a defect. It's part of how machines work. A basic function really. Screws can unscrew, and they will, if the machine is not left static. A gun left in the safe won't loosen up. A gun fired often will. So take measures to prevent it, and check screws regularly even if there's Loc-tite on them. Murphy's Law will almost certainly bite you if you fail to maintain your machines, and in my experience those failures will come when you least want them to happen.