Natural selection is the cornerstone of Darwinian evolution and acts on reproducing entities exhibiting variations that can be inherited and selected for based on, among others, interactions with the environment. Conversely, the replicating entities can also affect their environment generating a two-way feedback on evolutionary dynamics. The onset of such ecological-evolutionary dynamics marks a stepping stone in the transition from chemistry to biology. Yet the bottom-up creation of a molecular system that exhibits ecological-evolutionary dynamics has remained elusive. Here, we describe the onset of such dynamics in a minimal system containing two synthetic self-replicators. The replicators are capable of binding and activating a cofactor, enabling them to change the oxidation state of their environment through photoredox catalysis. The replicator distribution adapts to this change and, depending on light intensity, one or the other replicator prevails. In both cases the replicator distribution evolves towards higher dynamic kinetic stability, rooted in a faster replication rate under the specific environmental conditions. This study opens the world of chemistry to evolutionary dynamics that has until now been restricted to biology.