If I am understanding you properly, here is my take on it.
ABSOLUTE weight gain- Determined solely by (usable) calories in vs. calories out
Weight gain COMPOSITION- Seems to be affected powerfully by the macro-nutrient ratios. There is not a ton of hard science on this score, but there is a horde of anecdotal evidence that this is the case. From my personal experience tracking macros does matter. I have seen the best results with 1g Prot/lb. (didn't notice significant benefits going higher than this) around 30-40% fat and the rest in carbs.
In short, Absolute calorie intake is most important for weight gain, but macros most likely affect that composition. I don't think there would ever be a situation, assuming hard training, where 100% of weight gain would be fat regardless of macros, but every little bit matters when dramatic body comp is your goal.
Also there are a lot of benefits to eating a healthy diet aside from just weight gain so food choice matters on the pure health score (blood pressure, lipid profile, organ health, etc.) as well.