I think there is a defined wifi mesh standard, 802.11s
https://en.wikipedia.org/wiki/IEEE_802.11sI think it was used by the deployed OLPC (One Laptop Per Child) project back in the 90s/early 2000s, which wanted to send them to areas with no internet.
If you can get such a network set up, you should be able to route IP packets over it as normal?
I think during the Hong Kong protests, they also used peer to peer smartphone meshes over either Wifi or Bluetooth (can't remember). Might be worth looking into?