Your question is based on a false assumption namely:
So why didn't NASA take money from the private sector to do these
later two on the behalf of corporations?
NASA did take money from the private sector to do these things. The STS-5, STS-7, STS-8, STS-41-B, STS-41-D, STS-51-A, STS-51-D, STS-51-G, STS-51-I, STS-61-B, and STS-61-C Space Shuttle missions all launched comsats for paying customers. The original plan, ridiculous as it was in hindsight, was for STS to be the sole US launcher of all payloads.
However, after the loss of the Orbiter Challenger only seconds into mission STS-51-L, US policy was changed to only allow the Shuttle to launch scientific and military payloads that required human presence. This destroyed any economic rationale for making STS self supporting or a revenue generator.
The first 4 missions were test flights, so omitting them, you can see that 11 of the 21 "operational" missions before the policy change carried commercial satellite payloads, often multiple, up to 3 comsats per mission. A total of 18 commercial satellites were deployed from the Shuttle. Commercial payloads were very important. Coke and Pepsi even paid to fly their products on STS for promotional purposes.
Now, did the planned economics make sense? Almost certainly never. Cost projections were based on unrealistic flight rates so the efficiencies of scale were never going to happen.
Data on early comsat launches culled from NASA TM-2011-216142
Shuttle commercial launch pricing policy, circa 1985:
(Text on page before scanned page:)
The price charged to a customer is based on the percentage of the
Orbiter's weight or length capability that the customer's payload
uses. To determine these load factors, the total weight (including all
support equipment) and the total length (including 6 inches for
(Scanned from STS Customer Accomodations JSC-21000-HBK, not currently online, in the queue to be scanned and uploaded)