Marginal stability in chemical systems and its relevance in the origin of life