How xxx.m, xxx_dynamic.m,xxx_static.m files are related?

What do you mean with recursively running? There are a lot of post dealing with how to efficiently call Dynare in a loop. See e.g. [Loop over parameters)

By the way: those files are called in different places. The _static.m file is for example called in steady state computation.