Rather than treating the dnf-cache specially, give each stage its own state directory that they can reuse. This should obviously be used with care by the stages in order to make the builds reproducible.