Sounds like you enabled iCloud Photos on both your iPhone and your MacBook Pro. iCloud Photos does a full synchronization with all devices connected to it (and sharing an Apple ID). That would have happened over the network even without the physical connection.
The goal of iCloud Photos is to have the all the devices that are linked to it contain the same photos. Initially, it would upload photos not yet in the cloud from each device to the cloud, then it would download any photos in the cloud but not on the device to that device, merging the device libraries into one cloud library that is also on each device. After that, new additions would be added to all devices, edits would be copied to all devices, and deletions would propagate to all devices.
That last part in italics is what bit you.
The normal way to recover the deleted photos would be to go into the album named "Recently Deleted" (under "Other Albums" in the Albums view on your phone), select the ones you want back, and use the Recover function to return them to the other views. Photos and videos will stay in Recently Deleted for thirty days (or until you manually removed them) to allow for this.