I previously mentioned Foam Fusion glue. It works quite well for foam and wood in a tight joint but, being very low viscosity, it does not fill gaps at all. My attempts at “cookie cuttering” foam shapes to fit around the trackbed are not precise enough for Foam Fusion to reliably work for attaching the foam to the wood. Since those joints will not be further shaped by hot wire tool, I realized that I could try something else and save the special glue for joining foam to foam.
The next candidate is polyurethane glue which I learned of from Luke Towan via one of his excellent how-to videos. (I knew of Foam Fusion previously but Luke also provided the impetus to try it as well). Polyurethane glue is a bit more viscous although it is still runny enough to drip down a vertical surface if you pour it on too heavily. It also expands which makes it excellent for filling the gaps between wood and foam. That same expansion property requires clamping unless you are not particular about how much the pieces shift.
First attempts with the new adhesive provide very solid joints so will continue to use it for the wood to foam joints. Here is an example of the expansion which came up out of a joint where I dribbled the glue in from the top.