But if we do assume its length is correct and its mass is wrong, we're back to the problem I mentioned before. Even if it's density is stupidly low (i.e. it has almost no armor, and massive amounts of empty space on the inside), it still is at a minimum 130 times more massive than the Vesuvius. That means for the materials used to build one, the Kilrathi could have built 130 (or more) Vesuvius-sized carriers.
Well, I certainly didn't say this solves all the problems - I just pointed out the weirdness in using an unrealistic mass to disprove an unrealistic length.
As for the issue of "how did they build it", I think we have to simply accept that there is no answer, and it doesn't matter. Origin needed a huge mega-dreadnought for WC3, so the Kilrathi built one. No matter how inexplicable this is, the fact remains - you can see clearly from the cutscene in WC3 that 22 km is exactly what they intended.
With that in mind, it's pointless to argue that it can't have been 22 km long, because the Kilrathi could never build it - however crazy and impossible it may seem, the fact is that they
did build one. And not just one, in fact. If, in the future, a new game ever needs to address this point - they'll find some explanation for it. Until then, we can only speculate.
One answer may indeed be that the ship is mainly empty inside - which doesn't make much difference in terms of the amount of metal needed, but it does make a huge difference in terms of the complex machinery needed. Here's an interesting comparison - a quick google search reveals that, apparently, a Nimitz-class aircraft carrier costs $4.5 billion to build (the new Ford-class carriers will cost twice as much), while a supertanker, being much larger than an aircraft carrier (the biggest supertankers are almost twice the size of the world's biggest aircraft carriers), costs somewhere around $150 million to build. Bigger need not mean more expensive and difficult to produce.