[fix][client][branch-2.10]Return local thread for the `newThread` (#19779)

### Motivation
The original fix is https://github.com/apache/pulsar/pull/18268.
But after the fix is cherry-picked, the fix is overridden when resolving
conflicts for cherry-pick https://github.com/apache/pulsar/pull/18211.
### Modifications
Return the local thread variables in the `newThread`.
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java b/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java
index 8997d71..90e1a59 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/util/ExecutorProvider.java
@@ -52,9 +52,10 @@
 
         @Override
         public Thread newThread(Runnable r) {
-            thread = super.newThread(r);
+            Thread thread = super.newThread(r);
             thread.setUncaughtExceptionHandler((t, e) ->
                     log.error("Thread {} got uncaught Exception", t.getName(), e));
+            this.thread = thread;
             return thread;
         }
     }