Malinois more so than GSDs were to be herding dogs, but as soon as man figured out dogs could be used with success in police work they were both conditioned to that work. Sheep herding exists, but much like hunting, it's an unnecessary hobby. But, much like hunting, it does have a strong, albeit small following and will have one for the foreseeable future. Somebody mentioned nothing the Pitbull was bred for is still legal...hunting is still legal...and even though I don't think they were ever intended to be any sort of hunting partner, they can do it well and it incorporates everything they were originally bred to do. Toughness, a competitive drive to fight, and a high tolerance of pain. I think every breed has a job it CAN do although it may not have originally been bred to do the work.
To be blunt...man no longer NEEDS dogs...at one point in time we literally, had a higher likelihood of survival if we owned hunting dogs. Now, we don't. At one point in time we were limited to the livestock we could contain and move without a dog. Now, we do not. Now it's all about want, we want to be hunters, we want to be "old school" and herd sheep with a dog, we want a pet, we want a show dog, we want to title a dog in sport, we want a police dog. Since it's want vs need we're seeing the decline of some breeds in respect of their originally intended purpose because either A: Their purpose is now illegal. B: Their purpose is obsolete. And C: Because most people nowadays don't want a dog for a purpose, they just want a dog. And where there is demand, there is a bum with an open palm ready to give you whatever it is you think you want in exchange for money.
As far as the solutions for these breeds where their working heritage in the "new world" is in question. I think all 4 are happening, right now, to one breed or another, in many different breeds. Some of the "rare" breeds with defunct jobs are on their way out, for good. Some are being bred for traits and drives they didn't originally have like these new "sprint race" sled dogs. Some are finding functionality in jobs they weren't intended for ie Malinois in protection (I believe the GSD was created with police work in mind, I believe it was an after thought for the Malinois who actually functions just as good for that purpose). And there are numerous artificial trials for many breeds...Schutzhund, Ringsports, Earth Dog, HGH.
It was mentioned that trials and breeders play no profound role in dogs...really? They are what help people see which dogs have what they want, and which don't, in a controlled setting. They are a place where breeders can go and watch, and learn the behaviors of not only their breed, but dogs in general. They'll learn what's good, what's not, what's acceptable in terms of faults and the degrees of faults in the real world, and what isn't. They're also giving access to contact with people who have similar breeding goals. Trials, shows, and breeders are the only reason we have modern breeds with specific purposes. Before, we had dogs who can't even be called mutts because they weren't mixed breeds, there were no breeds, they were simply dogs. Some were good at hunting, naturally, some were good at being guard dogs, naturally, some were good herders, naturally. Because of the breeder, specific breeding practices, trials, shows, competition...man has separated the traits he wants in dogs into different categories and even into different looks. Now you don't have to see which pups will be useless, which will be good hunters, and which will be a good guard dog, you have a dog who has a high probability of being useful for that task simply by choosing a breed, and a good breeder. You can even suit the breed to your style of training and situation. Small herd and softer training style? Get a BC. Large herd, harder training style, get a Malinois. Limited space? Like bird hunting? Cocker Spaniel. Do you have more space and prefer a larger dog? German Shorthaired Pointer. Have a warehouse to protect? Like a big dog with floppy ears who can get mean when he has to? Rottweiler. Erect ears, slightly softer disposition but can still do the job? Malinois, GSD...etc. Because of trials, breeders, and shows...not only do we have a dog for every purpose, we have several dogs for precise niches within that purpose, within that function. Some will continue, some won't, it depends on the people who love them, the role they play, and how good they are at it and at adapting if need be.