[JENKINS-48604] Do not downgrade plugins that are dependencies of detached plugins when upgrading Jenkins (cherry picked from commit 1dc2c6d5)