Make themes_on_rails thread-safe by not modifying the controller class on every request.

This should not have any difference on MRI since it as a GIL, but would impact parallelised implementations like jRuby and Rubinius. Furthermore, this helps with inherited layouts, since if a layout is defined via a Proc, it does not allow overriding by subclasses.