Sure, Hubble's way past its design lifetime, and it can probably limp along for another decade as is, and maybe something besides gyros will fail soon. But also there's no equivalent capability successor that's more than a study, and even if they manage to build HWO or something like it, it won't be operation for at least 20 years. A Hubble servicing mission would be a relatively cheap way to get a decade or two more time on a high-capability instrument.
Some of the Apollo missions had an EVA during the return transit to recover cameras on the exterior of the Command Module (CM).
Those spacewalks occurred on Apollo 15 (see: <https://www.space.com/20565-al-worden-apollo-15-astronaut.ht...>) and Apollo 9, which didn't land on the Moon (see: <https://www.lpi.usra.edu/lunar/missions/apollo/apollo_9/>).
According to this Stackexchange post, the entire CM was depressurised: <https://space.stackexchange.com/questions/38239/how-did-apol...>
During lunar landings, EVAs also required full depressurisation of the Lunar Module. Repressurisation took about two minutes:
This article states that the entire capsule would be depressurised and repressurised, as there's no integrated airlock. It also specifically mentions the prospect of servicing Hubble (though with no details).
<https://www.extremetech.com/aerospace/spacex-unveils-eva-spa...> (May 6, 2024)
That strikes me as both the most basic approach and a capability which would be useful for other reasons as well. Another option might be to carry along an airlock, perhaps stowed in Dragon's trunk, and mounted during flight, though that itself might require an initial (full-capsule-depressurisation) EVA.