Hi, and swelcome to the Apple (user-to-user) Community.
You might want to check the "Recently Deleted" folder.. eg: iPhone may be set to keep delketed photos for 30 days.
Apple support's article: If you're missing photos or videos in the Photos app - Apple Support
says:
"Go to Photos > Albums, and tap Recently Deleted in the Utilities section".
(The article also tells how to recover the photos.)
As you discovered, iCloud's main job is to sync files across all devices, making them available everywhere.:
When devices are in sync with iCloud, deleting files deletes them everywhere they are in sync.
Apple Support suggests:
Archive or make copies of the information you store in iCloud - Apple Support
All the best :-)