It sounds more like a socket issue than a cable issue. The metal rings you see on the male end(from the tip to the cable) correspond to left channel, right channel and ground. As you can see here, the lead that connects to the left channel functions both as an electrical connection and as (part of) the mechanism to keep the jack in the socket by way of a spring retainer. If it starts to wear out, it will lose some of its spring and won't fully bounce back and make a good connection. You can imagine that if you wiggle the jack around, it will sometimes make a connection with the spring arm, but it will be very shifty. Then there is also the problem of cheaply made things having sockets that are slightly too deep or shallow or having a pathetically weak spring arm, which can mean it barely works even when completely new.
TLDR;
Buy reputable brands and perhaps read a review, even if it's for something as simple as a cable. Even then you can just get unlucky.