In #80094 support for var substitution for cachedir was added but there are more options that should be supported. Using an API for prepend_installroot which should be done anyway provide that feature so use that. In addition, perform the operation once all substitutes are in place (releasever as well).