MDL-44141 Completion: System updates data during restore

The completion system has code which is supposed to prevent it
updating completion status while grades are being restored. This
code was a nasty hack and had not worked for some time. As a result
completion dates were restored incorrectly.

This commit implements a 'proper' way to find out if a restore is
currently running, replacing the previous hack.