Not that anyone reads them, but every cloud storage EULA has a clause describing how they may remove content at will, especially if it is illegal. That's their justification for why this scanning is happening on photos that are being uploaded to iCloud, and not simply all photos on every device.
> Apple reserves the right at all times to determine whether Content is appropriate and in compliance with this Agreement, and may screen, move, refuse, modify and/or remove Content at any time, without prior notice and in its sole discretion, if such Content is found to be in violation of this Agreement or is otherwise objectionable.
I have no problem with Apple, Google, Microsoft, etc.. Removing and reporting illegal content from their servers. My issue is with Apple doing it on your device or machine.
https://www.apple.com/legal/internet-services/icloud/
> Apple reserves the right at all times to determine whether Content is appropriate and in compliance with this Agreement, and may screen, move, refuse, modify and/or remove Content at any time, without prior notice and in its sole discretion, if such Content is found to be in violation of this Agreement or is otherwise objectionable.