dup the account chain before mucking with it

fixes CNVS-17308

some callers will want to add stuff to the account chain or otherwise
modify it. some do it in place, which is sad when we return a cached
Array. cache it, but return a copy of the cache, not the cache itself,
to prevent errors from this. Account#account_chain already did this.

particularly, in this ticket, code in RoleOverride.permission_for pushed
siteadmin into the return value from Course#account_chain. this meant
that site admin was already in course.account_chain on the second time
through this code, but the code didn't handle the sharding implications
of that (and shouldn't need to)

test-plan:
  - have multiple shards
  - create a course in an account on a shard that's *not* the same as
    site admin's shard
  - create an AccountMembership role in site admin with permission to
    manage courses
  - create a site admin user with just that role and log in as that user
  - should be able to manage the course in the other shard

Change-Id: Iaf3a19dc2a2c0c7372c82d2af197d9f936792625
Reviewed-on: https://gerrit.instructure.com/45463
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>