You are mixing up documentation for two different buttons from two different UI libraries.
You linked to UnityEngine.UiTools.Button.onClick that is the docs for the version of button from Ui Toolkit. That’s the event which is deprecated. It doesn’t say anything about deprecation of onClick in Unity UI button.
So if you are using Ui Toolkit you have to use clicked instead of onClick.
If you are using Unity UI it doesn’t apply to you. I am guessing that in your code you probably imported the wrong thing and thus got warning about wrong kind of Button and got very confused.
https://docs.unity3d.com/2022.3/Documentation/ScriptReference/ Contains documentation only for core unity functionality that’s only small fraction of Unity. A lot of Unity functionality is in separate optional packages that can be installed using Unity package manager. Each of those packages often have their own documentation using similar format as one you linked above. You can get the documentation link of most Unity non core packages in the package manager.