Whatever the applicable code is in the area/application, it should of course be complied with in this regard. However, aside from that and from a purely physical/philosophical standpoint it is obvious that it is physically possible to weld two pipe or fittings of whatever wall thicknesses together (of course as long as there is suitable radial interference in the dimensions of joining ends!) What one gets however when one does this is are inevitable "stress concentrations". There is a similar parallel for argument in a common application when e.g. a thin steel plate or gusset is welded to a much thicker plate, or e.g. when a very small diameter (and naturally much thinner) outlet or nozzle is welded to the side of a larger, thicker pipe.
The magnitude of stress concentration (or localized stress multiplier) is in a sense dependent on the off-set, the type/design of joining weld, and also I guess on the nature/direction of load application to the connection. In the extremes of provision for this in e.g. the thick tube, special products field (where cost is not necessarily as determining a factor and high loads/reliability/fatigue resistance etc. are a common object), I have seen some folks apply a slight excess/overlay of weld for some length each way in the thickness transitioning joint, and then in effect grind or machine smooth a “radius” in the transitioning weld area.
Stress concentration factors are available in mechanical engineering and other references for radii and other common fabrication transitions, to allow detailed stress analyses of the effects of the design chosen (and of course the smoother the transition and the larger the radius, the less the stress concentration or multiplier). I suspect where this is covered in code the code fathers or mothers have considered this effect in some fashion.
All that being said, in applications where there are not very high axial, bending, nor cyclical loads etc., and very high joining efficiencies are not necessarily required, there are weld joining means that it would apepar readily allow different thicknesses of pipes or fittings to be weld joined together with common fillet welds (particularly e.g. when there is a common outside diameters). Examples of this are “lap-welded slip”, “butt-strap”, and also various fillet welded rubber gasket joints such as shown (along with single and double butt-welded) in AWWA Manual M11 for steel water pipe, as well as perhaps some exterior socket weld type stuff for smaller pipes in other applications.