As the painting instructor on PBS used to say "Happy little accidents"
I suspect, just a hunch, that occasionally it may also be a case of bumping into the right load or ammo with rifles. In my collection I have a couple of older rifles, that were never though of as particularly accurate, that both turned in back-to back (I HAD to shoot second groups) sub 1" groups with factory ammo when I was just trying to see if they had a bullet weight preference.
I still will not discuss the groups I got, repeatedly, with my SOCOM16 @ 100 yds with HTM "Tactical" loads. I think the shorter barrel and the slight changes to the gas system helped my particular assembly of parts, as it were,
I have found a couple of accurate guns in brands that are bashed but I just think the bashing was undeserved, not that mine are anything rare.