avoid deadlock if crashing inside profile_wr_lock (#58452)
The rd/wr lock distinction here was supposed to help prevent deadlocks
by allowing recursion (even over signals), but did not account for
crashes causing recursion while holding the wr lock. Make these lock
acquires fail-able if they would cause deadlock.