Meeting noise regulations is the primary reason for using a long nacelle. Some engines may not need it. Since it adds weight and drag it is not used unless required. Use may be partially offset by improvement in efficiency, but this does not normally justify usage on its own.
If a particular engine design does not meet the specification, the long nacelle can block certain emissions 90deg to the engine axis which might make the installation compliant. Noise is generated where flows of dissimilar speed mix.
flow from a core mixing
An extended nacelle encloses noise from the instabilities, shielding an observer abreast the noise source where certification measurements are made. A short nacelle provides no shielding.
The engine installation has to meet noise requirements when it is certified for use on an aircraft. Some manufacturers surpass the requirements, attempting to appeal to customers that might be more noise sensitive. Rolls claims to have the quietest installation on the 330 and they are the only one with the extended nacelle. The underlying engines differ in design; they also differ in noise output. It wouldn't surprise me if the 700 core failed to meet the reg with a mid nacelle, exceeded it with the long, and the marketers turned necessity into a feature. The Trent 7000 is developed from the 787's Trent 1000 and has a different core and its installation on the A330neo
uses a mid length nacelle.
A similar but less critical situation exists for the flow from the front fan. The short nacelle on your 747 example would not provide as much noise shielding from the front fan as the mid length nacelle. The PW4000 is a derivation of the JT9D, so it is not the same engine as you state. More importantly, its certification on the 747 took place some twenty years after the JT9D under more strict noise regulations, hence the longer nacelle.