Add storage->instanceOfStorage() to handle instanceof with storage wrappers

When using storagewrappers `$storage instanceof \OC\Files\Storage\Local` can't be used to reliably check for a specific type of storage since the storage object might be a storage wrapper.
Instead `$storage->instanceOfStorage('\OC\Files\Storage\Local')` can be used which also checks `instanceof` with an wrapped storage.

This PR also replaces some of the existing usages of instanceof with the new function, usages of instanceof that are left are in the process of being removed (#8771, #8666)

cc @schiesbn @ringmaster @DeepDiver1975 @PVince81