Track selectionBefore in staging transactions

We track the previous selection in normal transactions, but we need to
do this for staged transactions as well.

Bug: 70175
Change-Id: Ibd10911b7e88cff6a190b4e5736e319496f68efe
Merge "Track selectionBefore in staging transactions"