Why is (1) considered correct, but not (2) ?
(1) This would have been such had it not been for...
(2) This would have been such hadn't it been for...
P.S.: Besides, should there be commas as well?
(This is a fairly vague answer, but it's my best shot.)
"Had it not been for" uses a grammatical construction that is quite formal. Because it is formal, this construction is relatively unproductive: it continues to be used (in formal contexts) in certain expressions that could be seen as more or less fixed, "frozen", or formulaic, like "had it not been for", "were it not for", or "had I known", but you can't necessarily use any words in this construction and get an acceptable result.
You aren't the only person to mention the apparent unacceptability of using -n't forms in this context. (If you'd like to add one of these links to your question to satisfy critical commenters, please feel free to do so, and I'll delete the link from my answer.)
BBC Learning English: inversion in conditional sentences
A discussion on the WordReference Forums: incorrect usage of "hadn't it been"
However, the may be some speakers who would judge this construction acceptable.
I don't think that there is any truly principled reason for saying that "This would have been such hadn't it been for..." is incorrect aside from the simple fact that it sounds bad. Negating verbs by adding the suffix -n't is a less formal construction.
There is no general rule of grammar prohibiting the use of an [verb]-n't form as a replacement for non-adjacent "[verb] ... not"; Haven't I told you that before? is a grammatical alternative to Have I not told you that before? In some cases, it seems like there can be a slight difference in meaning between negating a clause with -n't and negating it with not, but I can't figure out how that could be used to explain the unacceptability of "This would have been such hadn't it been for...".
I found this example of the "incorrect" construction on Google Books:
The puzzle might have lasted goodness knows how long hadn't it been for that consciousness of the good nature...
("The Question of the Mind", in Great Britain: Uncollected Writings, by Henry James, p. 314)
The essay seems to have been published 1915. You could say that grammar was different at that time, but I don't see why we would expect there to be a difference between the rules of grammar (in the technical, linguistic sense, not in the loose sense) used by Henry James and the rules of grammar used by all modern English speakers in this area.
A comma usually isn't necessary in a sentence formed from an independent clause followed by a dependent clause. That is the structure of your sentence, so I wouldn't use a comma.