Factor out ve.dm.Transaction.pushReplaceInternal

This helps us keep the `lengthDifference` and "maybe include metadata"
accounting in one place.

Change-Id: I4d38c1e1f3936679758d04b3f83d0d311fdaa65c
Merge "Factor out ve.dm.Transaction.pushReplaceInternal"