Lily and Marshall were the most stable couple in How I Met Your Mother, staying together the longest, but their story might have been very different had it not been for Ted. The trio's friendship characterized many moments over How I Met Your Mother’s nine seasons, and although Ted was originally Marshall’s friend, his friendship with Lily was just as fundamental for him and Lily herself in How I Met Your Mother. Ted’s history with both Lily and Marshall characterized their time in college when the two started dating, and How I Met Your Mother revealed in multiple instances how involved Ted was always in their relationship.
https://screenrant.com/how-i-met-your-mother-lily-marshall-relationship-ted-different/