While a 5kb function is immense, I work on a legacy code base and I have seen functions up to 2000 lines long. You possibly overestimate the quality of code that people in business actually write. I've worked in a few places and all have parts of the code which I would thought were made up if submitted to the dailywtf.
Also, have you ever seen a commercial library require >2MB of minified JS? Here's an example:
http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20153.84.min.js
That file is almost 2MB minified (5.6MB unminified).
And that is is only 1 of the few different files required for our dependency on it, there is a bunch more javascript/css also required. Would I use that library on a new product? I'd probably advise against it due to the size, but a legacy product has dependencies and you don't have the freedom to rewrite everything all the time.