What you’re seeing isn’t necessarily a “bug” in the traditional sense — it’s more of a quirk in how iPadOS reports charging status when power is coming through the Magic Keyboard. The keyboard’s USB-C passthrough port provides a lower charging wattage than plugging directly into the iPad's USB-C port. When the iPad is in use (especially with the M4’s higher power draw), that passthrough power might only be enough to slow the discharge or maintain charge, not actually increase it quickly.
The status bar indicator is tied to a certain threshold of net charging — if the incoming power is less than the iPad’s active power draw, iPadOS will show “Not Charging” there, even if the battery level isn’t dropping. Meanwhile, the Battery settings page looks at the raw current flow into the battery and can still register that some charging is happening. That’s why you get the mixed signals: one display is based on net gain, the other on power direction. Plugging the charger directly into the iPad’s main USB-C port should show consistent charging in both places.