The restored photos weren't in iCloud
https://www.synacktiv.com/en/publications/inside-the-ios-bug-that-made-deleted-photos-reappear
As for the photos reappearing after a factory reset of the device, there is no confirmed case by Apple about this ever happening, so I wouldn't take this claim seriously.