Due to the increasing demand for real-time observation data, remote-sensing satellites can be considered as users to access mega communication constellations, which can constitute a Low Earth Orbit (LEO) Double-Layered Satellite Network (DLSN) composed of Remote-sensing Layer Satellites (RLSs) and Communication Layer Satellites (CLSs). In this LEO DLSN, a Distributed Inter-Layer Topology Optimization (DITO) method is proposed based on time-space relationships between two layers, which can maximize task-aware observation benefits with limited onboard resources. For practical purposes, we take link switching interval constraints into account for the recapture and track of laser transceivers. Besides, we put forward a new time-slot division method based on the link switching interval for the linear modeling of the time-sequential coupling problem. With the simulation results in four constellation systems, the proposed distributed interactive method can obtain an optimal solution close to the centralized global solution with much less time. Simulation results indicate that the proposed method can support onboard optimization for future space networks.