Fix json autoload

When requiring the json core_ext, we are relying on AS's autoload to load the `json/encoding` file to avoid a circular dependency. Here we are incorrectly referencing the delegated config which is not yet available until we load `json/encoding`.

The fix is pretty straight forward, but adding a regression test for this is tricky. @jeremy wdyt about the test I added here? It [works](https://travis-ci.org/rails/rails/jobs/29762777), but have some doubts about it. Do you have better suggestions?

Fixes #16131