Almost always, yes, but not necessarily. The roadbed is a good idea if you want to ballast the track and for it to thereby have the typical profile for proper drainage and stability for heavy tonnage and higher speeds that the prototype would certainly have.
For spurs, industrial tracks, yard tracks, and such, these would be reduced in elevation so that rolling stock won't be able to move under gravity through turnouts and foul needed routes and cause accidents. So, if you happen to remember to look next time you drive past a mainline with a siding, remark on the apparent height of the siding rails compared to the main...they'll almost certainly be lower. Once cars are left there for any reason, gravity should not be able to play mischief.
But, track on foam, even with a thin layer of sound-deadening latex caulk, can still be noisy, particularly when running trains quickly along them. You can purchase thin cork sheeting at several stores and use this to still get the deadening of the sound and also a lower profile for your lesser tracks.
In any case, roadbed to foam, and track to roadbed, you can use a few track nails in the holes in some ties to help anchor the tracks in your intended line, but many of us simply use the cheapest acrylic latex caulk we can buy...it's all you need. A thin bead, then spread very thinly, will do a good job for the cork or foam roadbed, and then for the tracks. Often, soda tins and other things (full) placed over the tracks will help to weight them while the caulk sets.
That's it!