Midwest N Scale cork roadbed is about 5/32 " thick. You can use thicker, but may have to fill the area around it some to make it look lower.
Nails won’t hold track to cork unless they go through the cork and into some wood below. Predrill with a pin vise to avoid damage to the rail and ties.
A better way to fasten track is with glue. I use liquid nails or caulk spread thin under the ties. Both are permanent.
White glue will work and has the benefit of being removable. Just wet it down with some water and white glue will soften. Use nails to pin the track in place until the glue dries.
Nails will not hold in foam. You could, I suppose, use 1" thick homasote for roadbed; that’d hold the track nails. But you’ll have to affix the homasote roadbed to the foam with adhesive.
I would stick to a clor similar to the ballest you will be using. IE gray or Brown.
As far as product recommendation. I would avoid Locktites powerbond adhesives, IMO they bond very well and you will have difficulty removing the adhesive. Traditional latex liquid nails is probably the weakest I’ve worked with but not this application. Its cheap and doesn’t bond well to smooth surfaces IE the bottom of the ties.
Your best beat is to lay a small bead and smooth with putty knife before pressing the track into the adhesive.
When it comes time to remove, the putty knife will again be a very helpful friend.
Spread the caulk very thin. If it oozes up between the ties at all it is too thick. I used Liquid Nails for Projects (Foam compatible) rather than caulk. As already mentioned avoid switch point areas. With a very thin layer place the track and weight it with books etc to allow it to dry in place. If you need to move it, it is really easy to slide a putty knife, spreader under the track and remove it.
I have been using latex caulk for about three years now, and have had to lift and relocate track, which turned out to be a simple case of sliding a drywall knife between the flex and the roadbed (I use foam - cork has a limited life expectancy in the Dessicated Desert.) Cleanup involved rubbing the caulk off the plastic ties.
I also attach the (thin) foam to the cookie-cut plywood subgrade with caulk. The top layer (track to roadbed) is grey, so ballast holidays are not so obvious. The layer between the roadbed and the subgrade can be any color that happens to be cheap when you visit the retail outlet that sells it.
Use the cheapest clear latex caulk you can find and spread it very thin. Don’t use Liquid Nails if you want to reuse anything; that won’t come up. If the caulk squishes up between the ties when you lay the track, you have used too much. Use long hatpins to anchor the track while the caulk dries, then pull them out.
Roadbed is a scenic element, not a structural element. It raises the track to a realistic level. Most main line rights-of-way sit much higher than the surrounding terrain. So, yes, you’d still use it.