Many people recognize this pattern. There are countless stories, novels, books, movies, tv shows on it. People writing from personal experience. If you truly value your monogamous marriage then you'll avoid letting that tension build in the first place. That doesn't mean you'll never go out with a friend of the opposite sex. But you will avoid doing it too much. O course many people aren't even aware of this pattern so they let the tension build and then lose their marriage.
You can fully trust your partner. And your partner can trust themselves. That doesn't mean if they put themselves in that situation over and over that nothing will come of it. Further, you have no idea what the other person's intensions are, and even if the other person's intensions are platonic, they'll have the same tensions building.