In preparation for more create transaction and fund transcation RPCs,
refactor the transaction creation and funding logic into separate
functions.
This is a partial backport of Core PR13557 : https://github.com/bitcoin/bitcoin/pull/13557/commits/58a8e28918025c28f19ba19cbaa4a72374162942