I have something related. Two Pizero2s A and B talking over LAN. They autostart a pair of python programs that pub/sub to each other.
If the power goes off to A and is then restarted (same ip/port), the subscriber on B does not see the newly revived publisher.
As a test, when both running normally, I ssh in to A and sudo bootstrap. The connection is made and B gets the later messages.
Something in the boot closedown seems to do something (signal?) to clean up the subscribe socket.
I see the comment about port reuse and will investigate more.