Software does not really work like that. If anything, it's indicative of bad/falling hardware. Possible a sensor, or the actual battery itself. Unless the OP has a pre-release quantum computing based Macbook, of course.
Software cannot one day decide that a battery is at 2% health and the next it's at > 80%. Well it can, if the function is just returning random numbers from 0 to 100, but clearly that is not what is happening. It gets that value from some sensor, which isn't responding properly, if there are users who have seen 2% and no charging and then 90% and charging the next day. Also, there is probably some logic during the "initiate charging negotiation" that checks (if batteryHealth < some_number) then return false. Hence no charging.
When the temperature sensor on the SSD in my Mac Pro started failing it would exhibit similar, yet seemingly randoml, behaviour that you mention related to other users' reports. Sometimes my Mac Pro would boot up and sometimes it would not. Sometimes the AHT would complain about the temperature sensor and sometimes it would not. Sometimes I could work for quite a while and then I would get a kernel panic. Sometimes I would get a kernel panic after every 10 minutes. Eventually I could not boot up at all from the internal drive, but I could still access the drive perfectly fine using target disk mode.
TLDR: A battery should not be at 2% after 32 cycles and how long the OP has had the Mac for. It needs to be returned to Apple for them to fix it whether that involves replacing the battery, the sensors or the entire logic board, or all of the above.
It is possible for the OS to wrongly state the status of the battery or some other component of the Mac (for whatever reason). I am not saying that that is in fact the case here.
My battery currently shows (via the OS software reading) a current charge of 100%. If there was an error in the code that reads the current charge, I could see a reading of 50% , even though the battery has a much different charge capacity at said moment. For you to tell me software can't make that kind of mistake is implausible, especially when we are currently using an OS that has software bugs in it as it is running.
You have no way of knowing the real state of the OP's laptop anymore than I do. He could have a battery failure, a sensor failure, or an erroneous alert that was triggered by a software bug. The proper thing to do is to run the Apple Hardware Diagnostics test as I suggested, and then contact Apple to ascertain what should be done about the alert he got, as well as the results of the test.
If he had optimized charging turned on, his battery wouldn't be charging every moment it was plugged in per the OP. If that was the case and the message he saw was erroneous, then there may be no cause for concern, depending on what Apple said. Apple may request the laptop for review to see if there is an actual problem that needs repair. In doing so, Apple may not find any problems with his M1 per their hardware tests. If that latter is the case, that doesn't mean there isn't a hardware problem. it also doesn't mean there isn't a software glitch that alerted him to a problem that wasn't real. Apple makes the call.
All I was trying to do was start the process of getting more information and informing the OP of what I have read from other M1 owners about this same message, before you felt a need to correct me for a wrong I didn't commit. I said nothing wrong in my posts. The problem is your projection of what I said.
I am done with this particular conversation.