(PUP-3511) refactor Application.run for reuse

Extract a small chunk of code from Puppet::Application.run into its own
method so that it can be reused.  This code is currently duplicated in
Puppet Server; the introduction of this new `reset_environment_context`
method enables the replacement of the duplicated code in Puppet Server
with a call to this new method.
I don't like the name - this is not a "reset" - it actually pushes contexts on to the stack, much hilarity would ensue if it was called more than once for example. The context is not an "environment context" - it is a context for all of puppet that happens to have environment in it.

Also no so fond of moving these to class level methods that are then reused elsewhere. That reuse is less than obvious. How about breaking them out into a separate module ApplicationSupport? Then it is totally clear that they provide utility/support methods for "applications". There is no risk that derived classes call those methods etc.