When people talk about how much time it takes for an astronomical image to be captured, they mean the total time involved over many, many, many individual shots. All of those images are then "stacked" with fancy algorithms to generate the final image.
This is how these images of very dim, distant galaxies are created without foreground stars blowing out the whole image.
This image stacking technology has crept in to smartphone cameras in the last handful of years, most prominently as "night mode".
From researching a couple of earlier comments here: a chief reason the Hubble DSF was composed of multiple images was to eliminate individual cosmic ray events which otherwise fog / degrade such images.
If you're interested in distant constant objects, then near-transient signals can be safely ignored and removed.
Yes, one has to be careful about guessing what they probably did, because the processing was actually pretty complex, and astrophysics image processing is in general quite advanced. Saturation of the digital numbers coming from the detector is one consideration, but only one among many -- there is a lot going on.
The wikipedia article has a lot of details, including masking the CR's, removing some scattered light from Earth, the use of multiple color bands, and super-resolution using slightly different pointing from frame to frame. All this processing is done at the single-image level, and motivates dividing up the exposure time into chunks.
The ~340 exposures were taken over about 10 days and spread over 4 color bands. The typical integration time for one exposure appears to have been about 30 minutes.
There is also a tradeoff where every read from a CCD introduces a fixed amount of noise (called read noise), so there is a cost to making extremely short exposures. As a rule of thumb most individual exposures on a large telescope are ~20 minutes or so for an image where the plan is to stack many exposures. But sometimes different fields have unique constraints, and obviously JWST is a different beast than ground based telescopes.
This is how these images of very dim, distant galaxies are created without foreground stars blowing out the whole image.
This image stacking technology has crept in to smartphone cameras in the last handful of years, most prominently as "night mode".