I know a lot of successful gunsmiths. They're the ones building guns for gun games. Yeah, anyone can order the parts to build an AR, but darned few can make them run competitively for 3 gun. How about a Bullseye gun? Or an Open or Limited gun for USPSA? Or take a look at the folks adapting 100+ year old designs to withstand the rigors of competition at SASS matches. I'm not really a shotgunner, but the O/Us and autos I see on the trap line and skeet field don't look a heck of a lot like anything you buy off the rack. Someone's gotta be building them. Do many people shoot stock rifles at precision/sniper matches?
As for general repair, it probably has declined. Plastic pistols and Lego rifles are pretty reliable, and easy enough to replace parts when they choke. Most guns these days just don't need a specialist to make them work. Compare an 870 to a '97 or Model 12, for an example. Another consideration is that the vast majority of gun owners just don't shoot all that much. It's not uncommon to see a gun that's been neglected or abused to death, but how often do you see one worn out? Even the more serious shooters tend not to pile up huge round counts on individual guns, since they tend to own so many. The last 25 years or so, the industry's growth strategy hasn't focused much on selling guns to non gun owners, but rather selling more and more specialized guns to the same owners, to fill niches they didn't know they had. Even if a serious rifle hunter does practice a lot, the chances are excellent that he's spreading it over a rimfire or 3, a light varminter, a heavy varminter, a lightweight rifle, a plains rifle, a brush gun, a general purpose .30, an elk blaster, and maybe even a safari rifle for that trip he always dreams about, but may or may not ever take. Shotgunners may have an upland gun, a clays gun or six, a waterfowler, a turkey gun, a slug gun, etc.
Then too, at one time, if you wanted a factory gun to be that specialized, or even useful, it had to be modified. Rifles needed bedded, floated, pads installed, receivers milled or at least drilled and tapped if you wanted to mount a telescope. Most rifles come that way, now. 1911s needed sights, ramped, throated, port lowerd and flared, mag well opened, extended controls, pretty grips, frame checkered, etc. Now, any and all combinations of the above can be had from any of a double dozen factories.
Factories still don't build championship ready guns, but for anything less, I'd be shocked if you couldn't find what you wanted in someone's lineup, somewhere.