bufus
I don't have a godot example I can give you, but I can see what that Unity shader is doing.
It's a multipass shader. That means it is running twice on every fragment.
Godot does not have multipass shaders, but it does allow you to put multiple materials on one mesh.
In the Unity shader, all it is doing is drawing "something is here" to the stencil buffer (for this purpose you can think of it like a screen-wide texture)
The second pass is checking the stencil buffer and asking "is something already here?" If the stencil buffer says yes, then it doesn't draw. This way it ONLY draws the very edges, giving you an outline.
Maybe something like this can be done with multiple materials? I dont actually know for sure. Hopefully someone else can help you out more than me.