After spending the last 4 hours analyzing this issue, I can reproduce it when I disable wifi on host and client devices therefore forcing the connection to use Bluetooth. Automatic reconnections work not very well as they need a couple of seconds to reestablish.
I did find the following information from Apple on the developer forums:
Multipeer Connectivity accesses peer-to-peer networking through Bonjour. The system’s Bonjour support no longer works over Bluetooth. Thus, Multipeer Connectivity no longer works over Bluetooth.
...
Keep in mind that Multipeer Connectivity is effectively deprecated. While we haven’t officially deprecated it [2], most use cases are better served by other networking APIs. See TN3151 Choosing the right networking API for more on that.
Other developers are also reporting similar issues in their apps (no reply from Apple to this since March):
We have an app that runs on two iPads, in two different modes, that communicate with one another using Apple's Multipeer Connectivity APIs. Last week, after upgrading to iPadOS 17.4 we have had MANY customer reports of erratic connectivity, only on iPadOS 17.4. The iPads connect for 30 seconds to a minute, disconnect, reconnect for a short time again, and repeat.
...
it is easy to replicate the issue on iPadOS 17.4. You must be disconnected from Wi-Fi, but still have the adapter enabled. (We disconnect via the iPad control center.) The pair of iPads will only stay connected for about 30 seconds before disconnecting.
As I can reproduce the issue by disabling wifi, I think the connection falls back to Bluetooth, which is no longer working correctly and as the whole technology seems to be deprecated (although not officially deprecated yet), we can not expect any fixes from Apple.
Effectively this means that Adhoc networking without a wifi network no longer works. You absolutely need to bring your own wifi.
I will investigate other networking APIs (like Websockets for example) for version 4 but those will also need a wifi network. So effectively starting with iOS 17.4 and above, adhoc networking has been killed as far as I can see it.