After a couple the situation is probably over.
The average small arms exchange in the US is between 2 and 3 rounds, so this is correct.
fire 30+ shots would be silly
What if there are 4 attackers and they take cover and fire at you after the inital exchanges miss? I don't want to presume to predict what sort of tactical situations a person will find himself in - and I prefer to allow free people the option to prepare as they see fit, subject to reasonable restrictions.
30 rounds is one of, if not the standard magazine size for military rifles. 15 to 17 is standard for 9mm and .40 S&W pistols.
If you want to draw an arbitrary numerical limit and codify it into law, are you willing to guarantee there will be no need for additional rounds?