refactor(*): minimize dependency on thread local storage, simplify MK_THREAD_LOCAL_GET

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>