Hi, thanks for reaching out on that topic.
With the new Scene Context Menu it's not possible anymore to replace that menu. The main reason is that this would not be a sustainable way to do. Indeed, if package 1 does its own menu and package 2 the same, and a user adds both in its project... that will create conflicts and the default unity menu won't be accessible.
However, you can now add your own elements in that menu! Which is a lot more sustainable and that'll also enable multiple sulutions to co-exist without conflicting.
In the case of your example, just making this function would add the item in that menu:
[MenuItem("CONTEXT/GameObjectToolContext/Show Message")]
static void ShowMessage()
{
Debug.Log("Right-click menu button clicked!");
}
That's even shorter than your script :D
This example is extracted from that doc:
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Actions.EditorAction.html
You can also have totally custom menu when activating a EditorToolContext (such as Probuilder or Splines packages are using). In that case you'll be able to fully override that menu.
I invite you to read and comment the following post where we detail all of that even more and with more samples:
https://discussions.unity.com/t/feature-highlight-scene-view-context-menu/1515899
I hope this helps!