Preserve the LockData initial state if "potential deadlock detected" exception thrown
Summary:
Preserve initial state if push_lock() throws exception
test: Repeat deadlock tests
test: Add LockStackEmpty()
This is a backport of core#19340
Test Plan: With TSAN: ninja check check-functional
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D10059