We show for the case of interacting massless vector bosons, how the structure of Yang-Mills theories emerges automatically from a more fundamental concept, namely perturbative quantum gauge invariance. It turns out that the coupling in a non-abelian gauge theory is necessarily of Yang-Mills type plus divergence- and coboundary couplings. The extension of the method to massive gauge theories is briefly discussed.