Re-correct TSAN integration with task switching
This reverts commit 15772bafb7f16b7572895eb01a8adb8dcc8b8e97
"Update references to tsan state (#42440)", and fixes integration.
Looks like https://github.com/JuliaLang/julia/pull/36929 got reverted
when trying to simplify the code, but it now isn't legal. Since these
must be inlined in the right point in the runtime call/return context,
use a macro to ensure that.