They don't need to. iCloud uploads plaintext content hashes of all files even when e2ee is turned on. They know all of the users that have certain files, even if each and every one of those users is using the opt-in e2ee of iCloud.
Normal iCloud allows Apple to scan everything serverside, natch. This is 99%+ of all iCloud users today.