I've managed to come up with a solution that seems to work without needing too many combinators.
All combinators are oriented with input at the top, output at the bottom.
From left to right, the top two arithmetic combinators are set to Each + 0 -> Each
and T + 0 -> T
. This isolates the T signal on the right, and the left one is just there as a delay to keep the data + enable signal in sync with the isolated enable signal.
On the middle row, the left decider is set to T > 0 -> Everything
, providing the update functionality, while the right decider is set to T = 0 -> Everything
which enables the memory when the train is gone, so the combined output from this row is always either the train contents or the feedback value since the two conditions are disjoint.
The bottom row filters out the T signal using an arithmetic combinator T * -1 -> T
together with another delay Each + 0 -> Each
, and this filtered signal is fed back into the rightmost decider on the middle row. This prevents the feedback value of T from interfering with the enable logic on the middle row.
I would have liked to avoid the delay combinators, and I'm still not 100% sure the two-cycle feedback loop will perform correctly in all cases, but this seems to be good enough for now.