KWin sets this when built from source and recommends that distros set it too; see https://community.kde.org/Distributions/Packaging_Recommendations#KWin_package_configuration. However this prevents ksystemstats from querying its memory usage; open the app, go to the processes page and search for "kwin", and you'll see that it has its CPU usage reported, but not memory. This is a somewhat significant omission as KWin is a core system component especially in a Wayland session, so being able to monitor its memory usage is important. `top` is able to gather memory usage statistics for KWin in this state, so ksystemstats ought to be able to do so as well.
cap_sys_nice appears to have been a red herring, and this was caused by https://invent.kde.org/plasma/libksysguard/-/commit/1f48d7e9c420a40372b7ecfaf20d99d2e876168c. It's fixed in 6.2.0 by Arjen Hiemstra with https://invent.kde.org/plasma/libksysguard/-/commit/f23b43c56df616ec8ca582676050cdf69b0727cd