why are not objects (materials) by reference in unity?

Hi. In c# all objects of the classes are the reference. In other words if you assign
ClassA class2=new ClassA();
ClassA class1=classa2;
class1.a=10;
then if you change class1 you see class2 changes too but in unity if you change a material object (mat2) you see the other material (mat1) will not change!!
Renderer renderer=GetComponent();
Material mat1=renderer.material;
Material mat2=mat1;

Materials like all classes are reference types so they are passed by reference. You can easily test this with the example you provided yourself.

Material materialA = new Material(Shader.Find("Standard"));
Material materialB = materialA;
materialA.color = Color.red;

Debug.Log(materialA.color);
Debug.Log(materialB.color);

Renderer.material however is a property that clones the material if it’s used in multiple places ( as mentioned in the API docs)

Use Renderer.sharedMaterial if you don’t want a clone