Am I correct that the ballasting should be one of the last things that is done scenically speaking?
I did the ballasting on my layout as soon as the basic landforms were finished: otherwise, most of the ballast and glue would've ended-up on the floor, as most of the layout is roadbed on open grid. That's why the track on the grade to my proposed second level is not yet ballasted. Also, there's some trackage through the industrial area of Dunnville that hasn't been ballasted, as I still need to be able to remove some buildings in order to be able to install a backdrop. I usually do at least the basic ground cover along the tracks at the same time as the ballasting, which tends to fix the lineside structures in place.
Should the rail and ties be painted before the ballast goes down?
Definitely paint the rails before ballasting, and if you wish, the ties, too. I used Polly Scale paint, mostly browns, for my rails, but other than incidental slop from painting the rails, I didn't bother with the ties. I still intend to go over all of my track to weather the ties and ballast, but at least it has a more-or-less "finished" appearance.
For painting the rails, I used a fairly stiff 1/2" brush to apply the paint, unthinned, right out of the bottle. The stiff bristles let you work the paint around the moulded spike heads, and the bigger brush holds more paint so that you can get farther on one brushload. On a lot of the switches, I used a greasy black colour, as the prototype does grease the moveable points. I generally do the turnouts first (make sure to not lock the points in place with too much paint).

On plain track with no turnouts, I paint about 12' to 15' at a time, then use a clean, dry rag, wrapped over my fingertip, to rub the excess paint from the top of the rails. Let the paint cure fully, at least 24 hours, before proceeding with ballasting. Many folks like to use an airbrush for this task, but I didn't want overspray filling the layout room with excess paint dust. Also, while I like Polly Scale for brushing, I don't like it for spraying. Floquil is too stinky for this job. Even with a brush, this work goes quickly, and you don't have to do it all in one session.
Don't let the ballasting scare you: if you use my method, or even a different one, follow the steps outlined, making sure that eveything is the way you want it before applying any wetting agent. And when you do finally get to the wetting part, and especially the glue part, don't be dismayed by the mess: when you're done for the day, clean your tools, sprayers, whatever, shut off the lights, and don't come back for a look until the next day. It will look better, even though not all areas will be completely dry. There were several areas on my layout that took over a week to dry, and the trackside "lakes" of thinned white glue finally disappeared.
Wayne