Fix threading bugs in RecursionGuard and TerminatingWithPathSpecimenBuilder

This attempts to fix issues discussed in #211 and #212, but making `RecursionGuard` and `TerminatingWithPathSpecimenBuilder` thread-safe.