Clarification of code path in LegacyAudioParameter

Can anyone please let me know the situation when a parameters return value from getParameterIndex() would not be the thing you would want to return from this function? ie What is the situation where you would want to loop through possibly thousands of parameters matching the pointers to pull out the position?

    static int LegacyAudioParameter::getParamIndex (AudioProcessor& processor, AudioProcessorParameter* param) noexcept
    {
        if (auto* legacy = dynamic_cast<LegacyAudioParameter*> (param))
        {
            return legacy->getParameterIndex();
        }
        else
        {
            // why won't just returning param->getParameterIndex() always work here?

            auto n = processor.getNumParameters();
            jassert (n == processor.getParameters().size());

            for (int i = 0; i < n; ++i)
            {
                if (processor.getParameters()[i] == param)
                    return i;
            }
        }

        return -1;
    }

just a wild guess, but maybe it has something to do with the vst standard forbidding adding parameters after initialisation. because i could imagine that the value of getNumParameters is set at initialisation to prevent this from work if adding parameters afterwards