This is optional. You don’t HAVE to use iCloud for your photos. This is no different that YouTube searching videos you upload for copyrighted music. If you don’t want your photos scanned, don’t upload your images to their servers.
You're 100% correct. I had my images on iCloud because I thought Apple put my privacy first. I was being naive. I've pulled all my photos off and am looking to move the rest of my data too. My iPhone and iPad just got a lot less useful.