This q is based on fairly incorrect premises e.g.
why are governments primarily spending their testing capacity on those admitted to hospitals or otherwise in critical condition?
[...]
once a patient is in a hospital with breathing difficulties... what good does a test do?
There seems to be a conflation here that "admitted to hospitals" is (nearly) always "in critical condition" and likewise that "with breathing difficulties" somehow also equates "in critical condition" and a Covid-19 diagnosis.
Besides HCW safety, addressed in Dr. Chiu's answer, there's an obvious reason to test someone with "breathing difficulties" (for Covid-19) to establish a differential diagnosis. I think first a diagnosis of what the breathing difficulties actually are is done, e.g. is it pneumonia? Second, the guidelines for further diagnosing the serious cases of pneumonia generally recommend establishing the actual pathogen, e.g.:
Optimal treatment of lung infections relies on rapid and accurate detection of the offending pathogen. Delay in diagnosis can lead to increased morbidity and mortality.
See also Use of antibiotics with chest infections for a bit more detailed discussion on this.
Additionally, early in the epidemic, evidence from China (Mar 4) was that [their] virus tests were actually rather insensitive, i.e. they could only detect high viral loads:
In the initial screening, computed tomography (CT) examination is needed for the auxiliary diagnosis. The diagnosis is
then confirmed by the positive results of the nucleic acid amplification test (NAAT) of the respiratory tract or blood specimens
using reverse transcription real-time fluorescence polymerase
chain reaction (RT-PCR). However, this diagnosis method is
highly limited: (1) When the viral load is low, the detection rate
is low, leading to false-negative results. (2) Only a positive
diagnosis can be made, but the severity of COVID-19 and its
progression cannot be judged (in contrast, CT imaging can
reveal disease progression). (3) The supply of the reagents
cannot keep up with the demand, and the quality of new products of major companies awaits to be studied and improved. (4)
It takes 1 day or longer to obtain the results after sampling. For
these reasons, Chinese researchers strongly recommend CT
imaging as the main basis for the diagnosis of COVID-19 in
the current situation.
So in such circumstances (low-sensitivity tests) the virus tests probably aren't even very useful for the mild cases, so "saving" [such insensitive] tests for these mild case is basically completely pointless.
(See also related q here on that latter issue: Why were so many Covid-19 negative tests among close contacts of the early Chinese cases? )