__wt_txn_begin has the following code/comment:
The comment says "We have allocated a transaction ID which makes it possible ..". We have not allocated the transaction ID yet, that is why we can check for eviction without rolling back. "not" is missing in the comment.
Unless I am reading this wrong, should be a trivial fix.
__wt_txn_id_check() does the allocation of the txn-id using __wt_txn_id_alloc. This happens as part of actual modification in a transaction by __txn_next_op. So allocation of a txn-id is deferred until there is some modification. Hence I believe when calling __wt_txn_begin we have not yet allocated a txn-id when we check for eviction.