you are correct in stating that there is an interaction between cable sheathing and polystyrene, as I had a sheet of 3" polystyrene stored under my attic based layout which was lying on top of a power cable going to a wall socket. A few years later I took out the sheet to make some scenery to find that the cable had sunk into the styrene. I don't know what the outcome would have been had I left it for a few more years, but a electrician friend of mine advised replacing that length of cable and re-route to the switch.Building baseboards entirely of XPS foam (if I have read correctly) is an unusual thing to do - not many do it.
I would have thought that XPS foam would be insufficiently strong to prevent sagging and would therefore require support. It's moisture absorbing and warping properties are probably not well known in the hobby. I would also suggest that 3mm ply would also be insufficient.
My suggestion would be to used tried and tested methods such as ply construction and limit the use of foam to just track-beds on top of ply.
I built my boards using 12mm ply and these have lasted 25 years, including a year of storage in a Sydney garage with extremes of temperature from -5 to +40, with no impact whatsoever.
Using foam, you also need to consider how you are going to attach everything on top of it - some glues destroy polystyrene and it probably won't hold any kind of pinning.
With regards cabling, I would recommend just cutting slots like I did in the cork that I use: https://modelrailways.online/Pages/Vu/PowerFeedingwithDroppers
Run the cable through holes in the surface and do all your cable runs underneath.
Please don't bury cables in scenery: as sure as night follows day, you will need access to it. Better to access it from under the board than to have to destroy scenery to get access.
Something else to watch: some foams have chemical reactions with the shielding on cables, causing the latter to break down and short. I would suggest that XPS is a bit too much of an unknown for me to be comfortable with it.