I had the same problem and this was the only google link that mentioned it.
So I think that the mesh is instanced from the file; if you change one of the materials, quit godot and then load back the scene you'll see the materials go back to what they where.
The solution is to add a material to the MeshInstance, NOT the Mesh. If you import a mesh, then the properties window for me shows:
MeshInstance -> Mesh -> Surface1, Surface2 etc
You can leave those surfaces alone, instead, if we want to change surface2m we need to add:
Meshinstance -> Material -> 2
Again, all in the properties tab. Now if you write:
$name_of_node.get_surface_material(index_of_material)
Will indeed return a ShaderMaterial. Also, the shader material will override what material is in the Mesh.
Hope this helps somebody!