[Don't merge for M06] [Updated] Refactor KernelTransaction to sort under WriteTransaction

This is a fixed-up version of #1257