What's the secret of special nodes?

Godot Version

4.3

Question

Some nodes are adept at hiding or taking over the work of other nodes. For example, Viewport prevents nodes derived from CanvasItem from rendering themselves, and CanvasGroup takes over the rendering of its children.

How does it work? Can I define specific behavior in my own nodes? Programming in C# I haven’t found any virtual members associated with children that I could override. I suspect that this behavior is not achieved by polymorphism, but by some kind of internal type checking of the node, depending on which node will handled differently - that would be very sad.