The issue you will have with the ESP32 as both the BLE scanner and Wifi Gateway is that the ESP32 uses the same radio for both & as you scale up the number of BLE devices you will have problems.
For my BLE to Wifi gateway I ended up using a nrf52840 as the scanner, then sending the data to the ESP32 via serial. In this way the XIAO is scanning for BLE & the ESP is focused on Wifi and logging to SD card in my case.
If you don’t want to roll you own, Minew make a G1 BLE to Wifi Gateway for $US65