If there's a medical need to shear the dog, then the consequences (far more grooming required, possibly additional shelter needed) until the dog's coat is regrown maybe a year later are just a consequence and equally necessary. Also, if the consequence is that the dog loses a few top coat hairs, then that's how it is. Medical need means that the consequences of not shearing are worse.
In contrast, the other question discusses whether shearing (without medical need) can help the dog over summer. And there the answer is that already the consequences of the top coat needing many months to regrow are not worthwhile.
Also, possible changes in hair composition due to shearing are of course more of a concern if the dog would be shorn regularly rather than once due to medical necessity.
The first question is maybe what you consider severely matted.
There are rescue cases that are indeed shaved because there's almost no fur that is not in a mat.
Here's the level of matting I have experience with, and that I'd call severe matting in the everyday sense (severe vs. mild: mild can be sorted out by combing, severe cannot): a Newfoundland dog in a region with sticky loamy soil and plenty of burrs, blackberry etc. This will produce a composite material which is the canine analogy to steel-reinforced concrete in no time. The practical way to deal with this (even a Newfoundland will get to the limits of his patience) is to take a scissor and cut off those things.
The first difference to shearing is that you'll cut this off as far away from the skin as possible.
The second difference is that this does not happen at arbitrary places all over the dog, it happens in particular spots. E.g. between the legs, in the axilla and groin regions. These regions have little or no underwool, they pretty much only have outer coat hairs. Thus, in these particular places, you don't have much of a problem with undercoat wool growing faster. (I guess evolution found out that having underwool there will lead to endless mats before wolves could appoint a human to groom them...). Other areas with plenty of underwool, e.g. the back, shoulders or outside of the thighs are far less prone to matting.
In any case, you only cut away what is strictly necessary. (You can also try to cut away only the outer part of the mat and see whether you can comb out the rest)
However, if you have to shear the dog because it is completely matted: I've seen a few double coated dogs that were shaved. They all did grow back a fully functional coat in time. That "in time" can be a year or so, though.
Meanwhile, the dog will look a bit like having puppy fur - alternatively, like an exploded sofa cushion. In that state, you'd have to take extra care:
- since the coat is not yet fully functional again, the dog may have to live largely indoors, depending on weather.
- in the "exploded sofa cushion" stage, the fur collects a lot of dirt, burrs, you name it, making it more prone to mat again. But this is not given, you can prevent it by grooming the dog. But you'll need to groom far more to prevent more matting in this stage than you'd need with the coat fully functional.