[bt][bt-gatt-svc] Don't hold lock when calling device_remove

GattRemoteServiceDevice holds a lock when it calls device_remove in
DdkUnbind. It then tries to acquire the same lock when it receives
DdkRelease which can cause a deadlock. This is now fixed by releasing
the lock before calling device_remove.

Bug: 34747
Test: bt-integration-tests in a loop should not hang at "disconnect"
test.

Change-Id: I5e45b3c96505fda118ed12689d8b1ebf105ad80f
diff --git a/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc b/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc
index 3c158179..29f4079 100644
--- a/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc
+++ b/src/connectivity/bluetooth/core/bt-host/gatt_remote_service_device.cc
@@ -196,11 +196,15 @@
   async::PostTask(loop_.dispatcher(), [this]() { loop_.Shutdown(); });
   loop_.JoinThreads();
 
-  std::lock_guard<std::mutex> lock(mtx_);
-  if (dev_) {
-    device_remove(dev_);
+  zx_device_t* dev;
+  {
+    std::lock_guard<std::mutex> lock(mtx_);
+    dev = dev_;
     dev_ = nullptr;
   }
+  if (dev) {
+    device_remove(dev);
+  }
 }
 
 void GattRemoteServiceDevice::Release() {