Thanks for the answer Shachar.
So, I narrowed my issue to lights only. I only need to detect if a light is a duplicate.
I cannot rely on the naming because if I have 2 lights with their default name, and try to duplicate the first one, I'll get a numerical increment on the second, not the first. Also, duplicated or not, the naming number increments sequentially.
I've been thinking about this for a while, and I think I have a solution. Lights have a unique ID, and if I manage to save this ID into some property of the light, once the light is duplicated, this property will also be duplicated and I can look into in on the new light and figure out the original ID of the original light!!
This is all good, except for the fact that lights can't hold any user property. At least I don't know how. So my idea is to store this ID in the alpha channel of the color (since it's not actually used). I need to check it periodically though since I suspect changing the color of the light also resets the alpha channel.
I'm going to try this now and see how it goes.