(PUP-3038) Cache typeloader misses

Reference to defined type defined in global scope makes puppet look for builtin type with same name in all known directories which is slow in large repositories.

This change potentially introduces problems for server processes that are never restarted/reloaded - i'm not sure how much of an issue that is. IMHO when one deploys new module, new code, installs new gem, etc - it is ok to require server to reload, this can be easily automated.

This combined with another PR i'm going to created in a moment gives 70-100% performance improvement for both puppet catalog application and server-side catalog generation and none code-staleness issues so far.
yeah i converted because there are bunch of similar lines below just so that chunk of code looks consistent