The straight answer to this question is that No, infidelity is not caused by problems in the marriage. Not even sometimes.
Relationship dissatisfaction and a desire to end a relationship might well be caused by marital problems, but there is a huge range of choices a person might take if s/he feels that way. An affair is but one of them.
Since a huge number of affairs arise despite the absence of marital discord and a desire to exit that relationship, it is more logical to determine what is the common denominator in people's choices to be unfaithful and why they make them.
That common denominator is poor coping mechanisms.
It assails the person unwilling to make an ethical choice in an unhappy marriage, the person who feels entitled to an adventure when life gets mundane, the person whose esteem is low because of a career slump, the person who derives their esteem from sexual admiration from new others, the person who has bad boundaries with friendships, the person who has difficulty coping with change and the person who has prescriptive romantic and political beliefs. Regarding the latter, the person who believes in 'soulmates', that 'happily married people don't cheat' and has very prescriptive views of male and female roles is especially at risk of deciding to have an affair.
I'm sure it was a typically goady post and probably not worthy of comment therefore, but I don't recognise this description of a 'mantra' that exists on Mumsnet or anywhere else of fragrant faithful wives, entitled married men and 'bitch' OWs. The last time I recall that myth being espoused was by the Judge in Jeffrey Archer's libel trial 26 years ago, which was fortunately debunked by his subsequent conviction for perjury.
Obviously, those goady posts also confused the issues addressed in my first paragraph and which have been so eloquently separated and explained by earlier posters, but the myth mentioned in the title of this thread is (perhaps understandably) a defence mechanism for a great many people. It is commonly believed and expressed by those who've been involved in infidelitous relationships and those who believe that their individual efforts in a relationship will prevent an entirely separate person's infidelity - as well as easily-dismissed internet goaders looking to get a reaction to their attention-seeking posts.