Vanced was not open source, supposedly to avoid angering Google by openly sharing the mod. Not sure how that makes sense though now that I think about it
You should be allowed to distribute your own code. The Youtube app itself is Google's intellectual property so I understand why they did that. I hope they can release the mods so we the users can apply them to the app ourselves