I suppose you want to make games with programming ( the best way to make good games )
I disagree with your assertion that programming is "the best way to make good games"; players generally don't care how games were made as long as the games are good. If your goal is simply to make a game (or games) and you can do a good job of that without doing lower level programming, then you should go ahead and do so.
Learning some programming basics outside of Unity is probably a good idea, but I would suggest the idea that a person must program a complete 2d game before trying to use an engine like Unity is probably taking things too far; Unity is designed to be beginner friendly, and there's no reason a person couldn't make their first game with Unity rather than spending time learning an unrelated library first.
If you're really interested however, it won't cost you anything (other than a little time) to also download and try UDK so that you can choose the one you prefer rather than basing your decision on the opinions of others. You'll likely find UDK a little less beginner friendly, but it's obviously a very capable option, and as mentioned by Olaf above, for some people's needs to UDK licencing can be more favourable than UDK; it all depends on what you actually need.
I wouldn't bother going to extensive lengths to learn other libraries and build a game at a lower level before using one of these engines unless you really want that experience rather than just wanting to make games; players don't care how games were made, and you simply don't really need to do that in order to use a package like Unity effectively. If you do want that experience of working with a lower-level library before transitioning to one of these engines (and I can't stress enough that this should only be done if you want to -- don't feel it's something you must do) then I would probably recommend starting with C# and XNA.
: :Elaborated on my response to more directly address the original poster's question.