Enhance RecursionGuard and TerminatingWithPathSpecimenBuilder to be thread-safe

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