Apple - Why is the System Preferences Dock icon showing a Badge?
I clicked the iCloud pane, and found it was suggesting I improve my security posture. When I did something about that, the badge went away.
I did that only after I'd tried logging out and logging in again. I guessed restarting the computer wouldn't change anything, so I didn't try it.
I just had this. First result in Google search was here (Apple SE). The second result was Apple Support Communities which had the advice:
Open it up and see what preference pane it jumps to immediately. I think it wants you to sign up for two-factor authentication. You don't have to sign up, but you do have to either accept or reject two factor in order to clear the badge and restore functionality to System Preferences.
For me, it jumped to the iCloud pane which had a not-so-clear alert about two-factor authentication, which was the issue the badge in the dock was alerting me about.