Propagate frozen state during transaction changes

Currently the frozen state is not propagated through transaction changes (it's needed to be able to rollback to initial state) and it leads to an exception like #18191

It was introduced in 40496430d5825f55d1b8aa063f6642b82f6c65d5, during the time when `remember_transaction_record_state` was broken and during the revert it's gone unnoticed 9d2146ac6e4c1fdc9cc157d614b1eb9968ac6a2e

This is a rare case, but as the issue above shows still can happen.