It is not scanning all of your files, only those which will be send to iCloud. Scanning for part of pipeline in sync process, so it even can’t scan other files.
But yes, currently Apple can access all your images on the cloud, but with this change they would have been E2E encrypted, hence improving privacy.