fixes in ActionController::Dispatcher and ActiveSupport::Dependencies error handling code

Please find two patches fixing error handling in actonpack and
activesupport:

https://rails.lighthouseapp.com/projects/8994/tickets/4732-patch-actioncontrollerdispatcher-fix-for-handling-of-applicationcontroller-load-errors

https://rails.lighthouseapp.com/projects/8994/tickets/4731-patch-fix-activesupportdependencies-removes-properly-loaded-classes-nested-in-autoloaded-modules

I've put full descriptions into the tickets. Error cases can also be
tracked by looking at the added test examples.

Please review

Thanks!

Serge