SurfaceManager line 410 defines any renderer with more than one material as a complex material and then reverts to a triangleindex based approach to detect which material applies to the specific location the raycast hit. Surely this should be checking the MeshFilter subMeshCount, not the MeshRenderer's sharedMaterials count?
Unity's default behavour if there are 2 materials and 1 submesh is to render the same mesh twice, once with each material. There are several reasons why a simple single submesh object will have multiple materials, such as a procedural overlay or a visual effect like a glow or terrain blending effect. In this case it's not a complex model where you need to rely on triangleindex.
The triangleindex method also fails automatically on convex meshcolliders, so it would be best not to revert to this method if the simple one will work.
Unity's default behavour if there are 2 materials and 1 submesh is to render the same mesh twice, once with each material. There are several reasons why a simple single submesh object will have multiple materials, such as a procedural overlay or a visual effect like a glow or terrain blending effect. In this case it's not a complex model where you need to rely on triangleindex.
The triangleindex method also fails automatically on convex meshcolliders, so it would be best not to revert to this method if the simple one will work.