This has been confusing me for a long time.
There are several paths leading to materials in meshinstance
Imported materials stored as built-ins, are stored in .mesh file (1), and can be accesed with this property of Mesh Instance. Materials of mesh instance (2) naturally override them, these methods are contained within MeshInstance class, check it in docs ( for example
surface_get_material(x,y). Material override is one material overriding every surface at once. In Godot 3.5 there is also material overlay, but it seems broken...
Whatever You plan to do, You won't be able to OVERLAY material with your light code. This will erase effects of fragment and vertex, they will be completely overriden.
I usually collect references to all materials in code, and create new ShaderMaterials with my shader file, swap old materials with new ones, and only set old
albedo_colors as my new materials color parameter.