As I commented in the bundles thread...
If you were to call drupal_container() from within a WebTestCase test, you would get the container of the main environment, not the test environment. So, if using run_tests.sh all that would be in it would be the config system services. However, when an actual request is made, e.g. using drupalGet() or drupalPost(), the full container for the test environment gets booted up for that request.
This is bad. The tests should have access to a fully-loaded DIC, with the particular services required by the test environment. Here's a first pass at providing this. Unfortunately it makes drupal_container() even uglier than it already was :-/
Also, I can't figure out how the testing container ends up having a 'request' service - it shouldn't, because that only ever gets set by HttpKernel when it's handling a request, but the testing kernel never handles a request. I am confused. Anyway, that is the only reason for the change in path.inc (because now this also fixes the problem described in #1719936: Theme API tests and Theme functions tests broken if run in a browser).