John, I also do not want to glue the track to the foam. What I do is to use screws through the track holes into the foam. Obviously the foam won't hold screws strongly, so I use Gorilla Glue, a few drops down the hole before the screw goes in. Gorilla glue is actually a slightly expanding foam glue that creates a very strong "socket" in the foam to hold the screw. This is surprisingly effective (was surprising to me when I did my testing).
I have also used a combination technique with a type of fastener intended for sheetrock, which looks like a screw and a socket. I use a nail to set the position where the socket should go, then widen the hole, drop in some Gorilla Glue, then install the socket. After the glue has set the track can then be installed with a screw, and even unscrewed and removed at a later time.
If I can find a picture I will add to this post. Here they are. They pics show the sockets going into 2" foam with a Woodland Scenics grassmat glued to the top of the foam. Just to be clear, the foam is not visible in the pics, but it is what is holding the anchors, not the grassmat.