Clone cached tables before returning them to users in mw.wikibase

So that any changes they perform will not persist between several
invokes.

Bug: T76946
Change-Id: I6a085bec4190cbf158ef72125885b9d51e1c51a5
(cherry picked from commit 37c1ab3eb1938147e1f7f5a75bf29b1daf3732ac)
Cache the "otherProjectsLinks" setting

This will make sure we don't always load all sites just to
compute that setting. This is for example relevant for pages
that are linked to an item, but don't have any links to other
projects.

Also it will make sure we don't loop over all 800+ sites
several times this often (in a test computing this list of
site ids took about 4ms with Zend on tin and 2ms with hhvm
on osmium, excluding time to fetch and unserialize the sitelist).

Change-Id: Id4398b1e3cfb88928b468c88559a0c65bb3c0248