I'd say the point when your master page is known would be right after your view has been resolved by your view engine. You can set your masterpage when calling the View method on your Controller though:
public ActionResult Index()
{
return View("index","masterpagename");
}
I think if you want to do anything with your masterpage THAT would be the way. I don't know the context of your question, but I assume you want to manipulate the view and/or viewdata depending on which masterpage is used? Maybe the solution to your problem is not programmatically getting the name of the masterpage in the first place?
Addition, after your edit:
What you could do is create a new 'Base' controller which inherits the default Controller class. Then you override the View methods, and tell your developers to use that:
public class MySuperController : Controller
{
protected override ViewResult View(string viewName, string masterName, object model)
{
// do something here so your masterpage is different depending on the context //
string newMasterName = "something-something";
return base.View(viewName, newMasterName, model);
}
}
I 'think' all other view methods either get routed through this, or are not used in your case (the ones requiring you to pass an IView).