Backport PreTransRecordTrees are likely optimizable.

(cherry picked from commit c2ba014735dc36c9f0fe1ee7782a9c55bc67a460)