Santafewillie is right: paint your rails before you ballast. I used PollyScale paints on mine, applied with a 1/4" brush. It's boring work, but goes quickly, and it makes a surprising difference. I did my scenery, at least the basic landforms, before ballasting. If your layout is on a table top, with no scenery below track level, then you can do either scenery or ballast first. I have quite a bit of scenery below track level, and some track is on embankments, so a lot of the ballast material will roll down the slopes at trackside. If you don't have these areas covered with plaster or another scenic base, the ballast will end up on the floor. I often do some real basic groundcover alongside the tracks when ballasting, as it helps to make the track area a more integrated part of the scenery that I apply later.
This scene is more-or-less finished. After the track was installed, the slope of the roadbed was done with plaster over screen. Then, in one operation, the rip-rap was applied, followed by coarse fill, cinders, and finally ballast, along with the basic ground cover. Trees and bushes were added later. Without the plaster "ground" in place first, all of the material that's supposed to be supporting the track would've ended up on my basement floor.
In this shot, the sequence was the same: roadbed, track, landform, fill and ballast, along with just a touch of groundcover alongside the track. The rest of the scenery is yet to be added, but the track at least is already an integral part of the scene. By the way, I don't bother to cover the track when doing the plaster work, as I use a fairly stiff plaster over wire screen. If you use something like strips of paper dipped in soupy plaster, then covering the track makes sense. Removing that tape is easier, and does less damage, if the track is unballasted when when doing your plaster work.
Wayne