I am currently working on a project for my home where several ESP8266 (each with a relay) control lights. I have developed an android for this where I find the ESP8266s via mdns but the problem is that sometimes one or two won't be found ever (depends on the position where I am trying it). So my idea was to make them talk to each other so everyone knows like an list of ip addresses from the others. This would give me the possibility to find every ESP as soon as i have found one.
Waht you may be looking for is a mesh network, you can use the standerd lib ESP8266WiFiMesh. Mesh reduces the loading of smart devices on the router by forming a mesh between the smart devices.There are unluckely no examples ready to use but you can look at the provided example and modify it to your needs,
You find the lib in your core dir
but be aware there are a lot of open issues and PRs (which means lot of trouble in a stable production)
There is also the Arduino library painlessMesh. Its well documented and has lot of examples and can be combined with MQTT.
For MQTT there is one condition where you might consider this option, if you have deep sleeping nodes on battery (than mesh might be contra productive)