(perf) Several small performance improvements
This removes some "dev mistake" error checking, which reduces the
overhead of some common calls. It also makes some calls less common,
most notably it caches the environment of a node when it wasn't
explicitly set and it falls back to using Puppet.lookup(:environments).
This can drastically reduce the number of environment lookups in some
situations. For the resource_expression_spec.rb tests, this resulted in
a 0.6 second improvement (~3 seconds to ~2.4 seconds).