To some extend, these are very helpful. For instance, Mercury taught the United States a lot of valuable lessons about spaceflight, and in general each mission was safer than the previous one. Each Apollo mission learned from the lessons of the previous missions. This incremental ability allowed the mission to succeed.
Personally, I don't think a manned mission to Mars's moons is ideal for early Mars missions. The only thing that the Mars mission really does more risky than Deimos/ Phobos is it's easier to leave. On the other hand, it has less science and less appeal, although it does still leave some new science. There are several items which are more risky on one of Mars's moons. The possibility of micro-meteor impacts is higher. Such low gravity can cause issues. It seems unlikely that a Phobos mission would be productive for the entire time that a Mars mission would be. The atmosphere of Mars could produce some items (In-Situ Resource Utilization) that would be helpful in the required length of the mission. Overall, I think more would be gained from a direct to Mars mission. But I do think that the entire concept should be tested unmanned at least once, maybe twice, prior to sending humans to Mars.