refactor(demandload): use subclassed method for demandload replace_func

Subclass Placeholder and use the '_replace_func' method instead of using
an external callable passed to Placeholder to substitute values in
scope.

This fixes the issue where demand_compile_regexp must import re in order
to hand re.compile to partial since that's now done when the
_replace_func method is called on first usage of the regex.

In addition, this fixes a subtle race issue under threaded conditions
most often seen when using `pmaint regen`. Specifically, sometimes
context switching between threads occurs at inopportune times when the
'_parse_EAPI_RE' regex (from pkgcore.ebuild.ebuild_src) compiled on
demand using demand_compile_regexp is used during regeneration to get
the parsed EAPI from the ebuild source.

What seems to occur is that the tuple of '(args, kwargs)' set as the
initial value for '_replace_func' when RegexPlaceholder is instantiated
gets replaced by the curried re.compile function and then a thread
switch or similar occurs and causes the following line from the
'_replace' method in RegexPlaceholder to be run again in the same
thread context somehow:

args, kwargs = object.__getattribute__(self, '_replace_func')

This raises a TypeError since it's now trying to iterate over a curried
function which isn't iterable.

This new code avoids the issue by encapsulating all the specific data
structure traversals within the subclassed '_replace_func' methods and
uses the same structures for all calls so types don't change
unexpectedly between context switches.