When you generate code for "fun1" (which is called as "entry-point function" in code generation terminology), codes will be generated for underlying functions as well in a recursive manner.
So if you modify any function which is called from entry point function, the MEX needs to be re-compiled.
Special Case :
The above mentioned details are not true when you call a function by making it "extrinsic" function. Coder pragma coder.extrinsic is used to declare a function as extrinsic :
When you declare a function as extrinsic, the generated code will call back to MATLAB to execute the function in MATLAB. So if you modify a function which is extrinsic, it may take effect without recompiling as well. But declaring a function as extrinsic will come with a performance hit.