Create upwards pointer in first referenced element and remove self refs

Fix for bug goobi/goobi-production#269