This method is old, complex, and confusing. It is also called by pendingWriteQueryDuration(), via TransactionProfiler, which might trigger the ping query...which seems overly complex and needlessly prone to degenerate situations during errors.
$lastRoundTripEstimate should be set via open() and have a method to just plainly return the value. Alternately, pendingWriteQueryDuration() could just not have $type (e.g. ESTIMATE_TOTAL).