Periodically check and remove indexes for non-owned data

At some point this check was lost. There were no test failures
because all queries have node filtering which prevent these orphaned
indexes from being detected.

This patch reestablishes the check and adds a test to prevent future
regressions.