4000: fix copying pipeline instances with newer templates

* When copying script parameters from a pipeline instance, check that
  the component exists in the source instance before blindly
  dereferencing it.
* Added tests for copying when components=use_latest and when
  script=use_same (the two edge cases exposed by this bug)
4000: tighten up functional test

Updated the test to ensure that a copied pipeline instance actually has
the expected script_parameters from both the source instance and source
template, respectively.
4000: update both functional tests.
Merge branch '4000-rerun-pipeline-changed-template'

Closes #4000.