Well, that's very simple. If we import from InDesign, there are no individual layers on different pages. All pages have the same Layers. Thus the script has to show or hide thruout all pages the Layer with the same name. If one later on creates a new layer, affinity should ask if this layer has to be created on all pages or only on the current page. If one creats a new layer on just one page, the of course this one is excluded from global show/hide. If one renames or deletes a Layer which exists thruout the whole document, Affinity has to ask if that layer should be renamed (and kept linked) or deleted on all pages, or only on the current page. And if a previousely linked layer does not exist anymore on one page, this should not affect the functionality on any other pages.
Or another attempt would be the possibility to have a Master page for each Layer with no content at all, and that I can add some individual Text frames on each page which are associated / linked to that Master page. And the Master Page will then only work as global show/hide. I'm still struggeling with the strange functionality of Master pages in Affinity, but it seams to work already half way like this. However, if a document is imported from InDesign, the relation between this Master page and its childes on the pages must be kept.
I did also test Viva, and this does not have this Layer issue. Usingb Viva, Layers imported from inDesign do work as expected. I see no reason why this should not work in Affinity??