Refactor write tracking implementation
Rather than duplicating code which wraps a package-internal class,
provide a subclass hook in TypedWriteTransactionImpl, so that it
write-tracking defaults to no-op and is optionally wrapped.
This removes a lot of duplicated code, making the result equally
performant and more maintainable. It also removes the need to leak
TypedWriteTransactionImpl.delegate to the package and tracking
them in two fields.
Change-Id: I636818f0048090c145e6fabba198238dad1e6922
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>