Yep, there are plenty of examples like that. It wasn't long ago that both Domenech and van Marwijk, two of the worst managers to be found anywhere, coached their respective national teams to World Cup finals.
There are no exact rules for this. Sometimes the manager is a small part of the success, sometimes he's chiefly responsible for it. In cases like Wenger and Mourinho this season I think it's fair to say that they have actively sabotaged their own teams (to varying degrees and for different reasons, one should add). I think Pellegrini's failures by contrast have more to do with things like rotten luck and internal politics at Manchester City. That, and a knock-on effect from the last few years where FFP managed to somewhat restrict City's spendings before the whole initiative dissolved into nothingness. It made it harder for them to start their big rebuilding project.