I'm not able to reproduce the TSan's "lock-order-inversion (potential deadlock)" warning for libdb for 24.x, 25.x and master branches neither in CI nor in different local environments (Ubuntu, Fedora).
If Tsan complains again, we can obtain a call stack from TSan, and this change can be easily reverted back.
Noticed while reviewing #27556.