[Support] Avoid setting minor/subminor/build in VersionTuple::withMajorReplaced (#139318)
The expectation of this API is that it only changes the major version of
a preexisting version tuple. However, it was adding 0's, which caused
unintended changes in serialization or printing.
Instead, check for the existence of the non-major parts of the tuple.