Mutualistic networks are vital ecological and social systems shaped by adaptation and evolution. They involve bipartite cooperation via the exchange of goods or services between actors of different types. Empirical observations of mutualistic networks across genres and geographic conditions reveal correlated nested and modular patterns. Yet, the underlying mechanism for the network assembly remains unclear. We propose a niche-based adaptive mechanism where both nestedness and modularity emerge simultaneously as complementary facets of an optimal niche structure. Key dynamical properties are revealed at different timescales. Foremost, mutualism can either enhance or reduce the network stability, depending on competition intensity. Moreover, structural adaptations are asymmetric, exhibiting strong hysteresis in response to environmental change. Finally, at the evolutionary timescale we show that the adaptive mechanism plays a crucial role in preserving the distinctive patterns of mutualism under species invasions and extinctions.