Yeah, this is doing it even when not charging. My iPhone will do the same when charging, too.My iPad from 2020 and my iPhone 12 does the same. If charging and at full brightness and in a warm area, the screen brightness would decrease until one of those were dealt with. You could even move the brightness slider to the top, but it wouldn’t actually change the brightness. It ONLY happened under those circumstances though. If it’s just sitting there doing nothing after a few days and STILL dimming, might be worth checking with Apple.