How does CRDB detect phantom

Example 1:
Both A and B are null at the beginning.
-------------------------- time ----------------->>
Txn 0: Begin;if read A is Null                                write B                             commit (fails)
Txn 1:                                 Begin;if read B is Null             write A; commit

Example 2: 
Both A and B are null at the beginning.
-------------------------- time ----------------->>
Txn 0: Begin; if read A is Null                       write B              commit (success)
Txn 1:                                 Begin; write A                 commit

Can someone give a detailed explanation on the process how example 1 phantom is detected in CRDB? I was thinking that at commit time there is a check on each read of the current transaction to see if there are commits with later ts than current transaction ts. However if this is true, example 2 should fail. Are we doing some tracing back of the precondition of committed transactions? If so how do we do it since transaction records are later deleted in CRDB?