The macOS "battery health" is only measuring the Maximum Capacity (aka Full Charge Capacity -- FCC) of the battery in relation to the battery's original Design Capacity. There is no real battery health monitoring within macOS except perhaps for extreme cases where the battery actually reports a hardware failure to macOS. The same thing applies if you are using a third party app such as Coconut Battery to analyze the battery.
I have seen the behavior you are describing while supporting thousands of my organization's Apple laptops. It is the behavior that occurs once the battery cells begin to fail, but macOS has no detection of this issue. Like I mentioned, sometimes you may be able have the battery condition show "Service Recommended" at the time this issue may occur if the issue is severe enough to drop the "Maximum Capacity" (aka Full Charge Capacity) below 77% to 80% of the Design Capacity.
If the battery charge cycles are over 1,000 cycles, then Apple should be able to replace the battery as well although I would expect it to show Service Recommended, but never had the opportunity to confirm.
Unfortunately battery failures are hard to detect and even harder to convince Apple to replace when the battery condition is "Normal" and the Apple Service Diagnostics do not report any issues. Your battery issue is one of those difficult to show & prove to Apple there is a hardware problem since most techs have no clue to how Apple's Lithium batteries behave in order to detect signs of failure. I am only aware of it since I had to develop methods of better testing & analyzing my organization's Apple laptops when users were reporting issues, but macOS & diagnostics said everything was fine.
Edit: I should also add, the behavior can be intermittent under normal running conditions. Even when draining the battery quickly by operating the laptop at 100% on all CPU cores may not always cause the battery to react with larger FCC fluctuations. There are a lot of variables involved here.