We study the challenging problem of the network partitioning and merging in context with the mismatch problem and the resilience of the logical structure in distributed hash table (DHT)-based routing protocols for mobile ad hoc networks (MANETs). The existing DHT-based approaches for routing in MANETs do not consider the merging of logical networks, which occurs because of limited transmission range and mobility of nodes. In this paper, we identify that the mismatch problem is aggravated when logical networks are merged, which directly depends upon the shape of the logical structure in which nodes are arranged according to their logical identifier. To address this problem, we first propose a leader-based approach (LA) to detect and merge logical networks. In addition, we discuss the effectiveness of a three-dimensional logical space and three-dimensional logical structure when logical networks are merged. In three-dimensional logical space and three-dimensional logical structure, we take into account the physical intra-neighbour relationship of a node and interpret that relationship in terms of logical identifiers. Simulation results show that the proposed DHT-based protocol along with LA outperforms the existing DHT-based routing protocol in terms routing overhead, end-to-end delay, path-stretch values and packet delivery ratio.