Fix mistakenly swapped lock orders in logging
Summary:
This PR:
- fixes printed lock orders
- improves the sync_tests unit test
- makes the "detected inconsistent lock order" error message pointing to the lock location rather tfm::format() location.
This is a backport of core#19353
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9731