I may have missed this in previous posts but, why would you ever permanently glue track to the foam. Did somebody suggest that? What "glue" did you use.
I glue my track, be it Unitrack or PECO 55 to my roadbed with Aileen's white Tacky glue. I also glue the cork roadbed to the foam top with the same glue. When it sets it feels permanent, however if it needs to be adjusted I soak a rag in very hot water, wring it out and lay it on the area and within 10-15 minutes I can just slide the bad spot around as needed. Then I place a weight on top of the rail and bingo it dries solid again.