The JWST only has a planned mission duration of 10 years. If it’s as epic as everyone claims it could be, there must be a follow up mission planned. So even if it fails, we’ll still see a successor at some point.
There are quite a few more telescopes planned, I think the next major one is the Nancy Grace Roman telescope, which is another infrared scope, made from an old NRO telescope. The decade survey called for another massive space telescope to look at the optical and UV spectrums, so Id expect that to be the next truly big flagship telescope.