Fix PatchExternalModules to run only on relevant changes
This task is only supposed to run when an external module changes,
since that is the only kind of module it touches. However, the inputs
of the task were set up such that it would also be triggered by any
change to a core module. This made `gradle install` after a simple
one-line change take unnecessarily long.