Init openthread stack after server init (#37073)

diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp
index 26e5dd3..7ef8434 100644
--- a/examples/all-clusters-app/esp32/main/main.cpp
+++ b/examples/all-clusters-app/esp32/main/main.cpp
@@ -212,8 +212,6 @@
     }
 
     chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast<intptr_t>(nullptr));
-
-    ESPOpenThreadInit();
 }
 
 bool lowPowerClusterSleep()
diff --git a/examples/all-clusters-minimal-app/esp32/main/main.cpp b/examples/all-clusters-minimal-app/esp32/main/main.cpp
index 8a9a74e..6066b21 100644
--- a/examples/all-clusters-minimal-app/esp32/main/main.cpp
+++ b/examples/all-clusters-minimal-app/esp32/main/main.cpp
@@ -187,8 +187,6 @@
     }
 
     chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast<intptr_t>(nullptr));
-
-    ESPOpenThreadInit();
 }
 
 bool lowPowerClusterSleep()
diff --git a/examples/energy-management-app/esp32/main/main.cpp b/examples/energy-management-app/esp32/main/main.cpp
index 9dff90b..e63c110 100644
--- a/examples/energy-management-app/esp32/main/main.cpp
+++ b/examples/energy-management-app/esp32/main/main.cpp
@@ -296,6 +296,4 @@
     SetDeviceAttestationCredentialsProvider(get_dac_provider());
 
     chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast<intptr_t>(nullptr));
-
-    ESPOpenThreadInit();
 }
diff --git a/examples/light-switch-app/esp32/main/main.cpp b/examples/light-switch-app/esp32/main/main.cpp
index 5646393..88b34f2 100644
--- a/examples/light-switch-app/esp32/main/main.cpp
+++ b/examples/light-switch-app/esp32/main/main.cpp
@@ -138,8 +138,6 @@
 
     chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast<intptr_t>(nullptr));
 
-    ESPOpenThreadInit();
-
     error = GetAppTask().StartAppTask();
     if (error != CHIP_NO_ERROR)
     {
diff --git a/examples/lighting-app/esp32/main/main.cpp b/examples/lighting-app/esp32/main/main.cpp
index ba3edee..9b2d6e1 100644
--- a/examples/lighting-app/esp32/main/main.cpp
+++ b/examples/lighting-app/esp32/main/main.cpp
@@ -213,8 +213,6 @@
 
     chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast<intptr_t>(nullptr));
 
-    ESPOpenThreadInit();
-
     error = GetAppTask().StartAppTask();
     if (error != CHIP_NO_ERROR)
     {
diff --git a/examples/lit-icd-app/esp32/main/main.cpp b/examples/lit-icd-app/esp32/main/main.cpp
index 04565a9..537399a 100644
--- a/examples/lit-icd-app/esp32/main/main.cpp
+++ b/examples/lit-icd-app/esp32/main/main.cpp
@@ -135,6 +135,4 @@
     sButton.SetUatButtonPressCallback(UatButtonHandler);
 
     chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast<intptr_t>(nullptr));
-
-    ESPOpenThreadInit();
 }
diff --git a/examples/platform/esp32/common/Esp32AppServer.cpp b/examples/platform/esp32/common/Esp32AppServer.cpp
index 978990a..3ddf35f 100644
--- a/examples/platform/esp32/common/Esp32AppServer.cpp
+++ b/examples/platform/esp32/common/Esp32AppServer.cpp
@@ -18,6 +18,7 @@
 
 #include "Esp32AppServer.h"
 #include "CHIPDeviceManager.h"
+#include "Esp32ThreadInit.h"
 #include <app/InteractionModelEngine.h>
 #include <app/TestEventTriggerDelegate.h>
 #include <app/clusters/network-commissioning/network-commissioning.h>
@@ -159,6 +160,8 @@
     }
     chip::Server::GetInstance().Init(initParams);
 
+    ESPOpenThreadInit();
+
 #if CHIP_DEVICE_CONFIG_ENABLE_WIFI
 #ifdef CONFIG_ENABLE_CHIP_SHELL
     chip::Shell::SetWiFiDriver(&(chip::DeviceLayer::NetworkCommissioning::ESPWiFiDriver::GetInstance()));
diff --git a/examples/thread-br-app/esp32/main/main.cpp b/examples/thread-br-app/esp32/main/main.cpp
index a03e29d..3c3e95b 100644
--- a/examples/thread-br-app/esp32/main/main.cpp
+++ b/examples/thread-br-app/esp32/main/main.cpp
@@ -151,8 +151,6 @@
     esp_openthread_set_backbone_netif(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"));
 
     chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast<intptr_t>(nullptr));
-
-    ESPOpenThreadInit();
 }
 
 extern "C" void otSysProcessDrivers(otInstance * aInstance)