The binding variable name $pagelink is used in the #fieldlink macro. You may be running into a naming conflict. Try renaming your binding variable (perhaps simply “$link” or “$image”).
This was due to the system originally being 5.71 and not heavily reliant on the site and folderids. If you update the Related_Content_By_Variant display format and add in the folderid and siteid columns these will then be added to the slot item and the folder path will be calculated based on it’s own folder id and not it’s parent.