This takes some of the logic from what's currently in custom base image branch
and applies it here for the main branch.
We need this in order to not depend on the logic that was
removed in https://github.com/containers/buildah/issues/5952
Note that with the latest rpm-ostree v2025.5 `--source-root`
is significantly improved and we don't need to manually copy
dnf variables or gpg keys.
Using `--from` to set the target releasever doesn't work yet because we
_need_ to set the `releasever` field since the repo files reference it.
There's a pending rpm-ostree PR to fix this but for now hack around it
by manually injecting the necessary variables in the treefile.