Part of #36692. Please view this PR in context of changes like #36694.
CTransaction gains a constructor that allows direct declarative construction as an alternative to building through CMutableTransaction. CTxIn's constructors gain an optional argument to pass the script witness.
It is a conscious decision that vin/vout are passed as generic input ranges and that only their elements are copied/moved.
Passing the std::vector by value and then moving the container itself into place would allow the following:
std::vector<CTxIn> inputs = ...;
CTxIn& backdoor = inputs.back();
const CTransaction tx{std::move(inputs), ...};
backdoor = ...; // <- modify `tx`, potentially breaking its invariant