All your devices which are connected to the same iCloud sync with each other and with iCloud itself. This is how iCloud is designed to work. Sync means that if you delete the photo (or data) on one device, that photo will also be deleted on iCloud Photos and so also on the other devices connected with iCloud (iPhone 7 Plus & iPhone 12).
Check each device and iCloud.com: If the photos are in the Trash folder, you can recover them from there. If you have deleted it from Trash and/or 30 days have passed, then they have been permanently deleted from the devices and from iCloud.
For future reference, you can choose to disconnect one or both phones from iCloud. Turn iCloud Photos OFF.
for eg. if you turn off iCloud Photos on the iPhone 7 Plus, it will no longer sync with iCloud. That means that photos taken on this iPhone will not upload to iCloud. Photos deleted from this iPhone will also not be deleted on iCloud.
Similarly, photos deleted from your other iPhone 12, will also not be deleted on your iPhone 7 Plus.