Deferred functions are currently evaluated eagerly as soon as the agent starts applying the catalog. This ticket is to see if deferred functions can be resolved lazily as they are needed. See PUP-9323 for details. A previous attempt was made in https://github.com/puppetlabs/puppet/pull/7254