Code experts can beat me up, as usual, with chapter and verse if I'm wrong.
But here goes...
The scope of the pressure vessel ends at the coupling, in the same way that if you build a pressure vessel which has a pipe nozzle intended to butt-weld into a piping system, without an attachment flange, the vessel scope ends at the end of that pipe nozzle. You can weld to that pipe nozzle without having to follow the requirements of the pressure vessel code in relation to hydrotesting etc.
However...
...that doesn't mean you can just weld and walk away!
The ongoing O&M codes DO set rules in relation to this kind of work. Minimum requirements will include compliance with ASME IX for welding, welder and procedure qualifications etc., as well as the NDE/testing requirements of the associated in-service code, or piping code in the case we're talking about my example of a weld to a pipe nozzle.
As has been mentioned, seal welding of existing threaded connections to prevent future leakage is something that is done all the time. It is also a questionable practice for new construction in my opinion, with the socket weld being preferable, but there are conditions under which it can be done without significant concern of future problems. The big issue is getting the threaded joint clean enough so that sound welding can be done- removing thread sealant completely from a threaded joint post assembly can be very difficult to accomplish, and it's an easy corner to cut when nobody is looking since the final joint can't be RT'd in any meaningful way. This is one place where careful supervision is required.
Hope that is accurate, and if it is accurate, I hope that helps!