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.