You would have to create a global event handler for this to happen. There is nothing out of the box to do this. Your event handler would have to do some lookups of the following fields on the
CMS_Tree table. I don't know the exact query or process but based on these fields and doing some queries in the database you should be able to get your code worked out.
NodeID = unique ID per content tree node
NodeParentID = parent content tree node of the current document
NodeLinkedNodeID = node ID of the page this node was linked from
NodeOriginalNodeID = node ID of the original node this page was linked from. Meaning if you created a linked page from NodeID 10, which then created NodeID 20, then you created another linked page from NodeID 20, it would have NodeID 10 in this field.
Clear as mud? Hopefully this gets you in the right direction.