Your battery needs to be replaced. Period.
There’s a very similar question that already addresses this question
However, you have a few statements in your question that should be addressed.
My usage of the laptop is just normal... I use it for mostly for reading books, videos on YouTube or movies
It doesn’t matter. The battery has no idea (and doesn’t care) what you use it for. Whether you read eBooks, write code or crunch numbers, your battery will do the same thing which is use a chemical reaction to move electrons.
Also I did leave it attached to the charger even after 100% charging but that is only more beneficial for the battery as many posts here state too.
This s fallacy perpetuated by well meaning but misinformed folks throughout the Internet. Leaving your charger plugged in doesn’t mean your battery is still charging. If you see the green light (MagSafe chargers) or get the “100% charged indicator” and your charger is still plugged in, it doesn’t mean the charger is still jamming electrons into the battery. The SMC will “disconnect” the charger electronically to stop charging. If you’re using the Mac, it will draw most, if not all the power from the charger first, battery second. The battery itself has an overcharge/undercharge protection circuit to also protect it.
You having to manage your Mac’s battery charging process - a machine that can literally recognize your voice and fingerprints, and produce some if the most brilliant videos on the fastest performing SSDs on the market somehow can’t manage a simple task like charging it’s battery is simply baffling.
Then why has the battery started malfunctioning when apple promises 1000 cycle counts and it's just been 312 counts.
Apple promises no such thing. The expectation is that a battery “should” have a life expectancy, on average, of 1000 charges. It’s the typical bell curve with some batteries lasting less and others lasting more. Granted, 2 years and 312 cycles is on the narrow, left side if the curve, but it’s not improbable nor unheard of. It’s just less common.
Why does it fail so soon? Any number of reasons, but likely a manufacturing defect. These are “man-made” devices so they’re not perfect. Each battery is composed of individual cells, you may have had one or more cells go bad. Maybe the SEI layer that is both necessary to conduct the electrons across the cell but also detrimental in that as it builds, capacity dies, has built up to the point that it can't function any more. Only a lab with specialized equipment and high power microscopes can tell.
Was the battery that I originally got faulty.
No exactly. The warranty of a Mac in the US 1 year. You can purchase Apple Care for an additional 2. I have a saying that that if a company is willing to warranty something for X years, means it is expected to last X+1 years. Using this “theory”, a new Mac with AppleCare including battery coverage is 3 years. The expected lifespan of a battery is 3 to 5 years. Seems to fit.
That doesn't mean there are outliers. There are some that last 6+ years meaning Apple couldn’t be happier. There are some that last only a couple of months meaning Apple is on the hook for a replacement much sooner than they were expecting.
The battery died prematurely. It happens as it’s a manufactured product. Unfortunately it happened sooner than you expected but there’s no “fault” to be assigned. It’s definitely a bummer and very inconvenient but there was nothing you did (most importantly) nor anything Apple did that caused it to fail.