They could have made a new one and launched that instead. The Hubble cost, up through launch, was $6.6B in today's dollars. [1] Making a second one would have been expensive, but less than that since you can reuse the design, software, and much of the experience.
The shuttle program cost $269B in today's dollars [2] so you need a lot of other benefits, not just fixing the Hubble.
I would also believe that they could have done all of the Hubble servicing missions with a capsule-style vehicle. If they had involved loading it into the payload bay and bringing it back to Earth to service on the ground, sure. But they were all done onsite, and you can do spacewalks from a capsule, too. I admittedly don't know any of the details, but I'm guessing that there's not really anything about the Hubble servicing missions that's fundamentally more difficult to do without a space truck than assembling Mir and Tiangong were.
No, as someone else pointed out the repairs were done in the cargo bay of the shuttle over the course of 5 days. GP is right though - just building and launching a replacement would make more sense that spinning up a shuttle program to do the repairs.
The shuttle program cost $269B in today's dollars [2] so you need a lot of other benefits, not just fixing the Hubble.
[1] "the Hubble cost-to-launch was $4.7 billion in FY 2010 dollars" https://www.nasa.gov/wp-content/uploads/2015/01/499224main_j...
[2] "The US Congress and NASA spent more than US$192 billion (in 2010 dollars) on the shuttle from 1971 to 2010" https://www.nature.com/articles/472038d