They do if they want clean, efficient code.
Believe it or not, the sourcecode at Google.com WAS written by humans.
Automatic page markup programs (like pagemaker, and pals) produce webpages alright, but they do so using many unnecessary elements, ham-fisted scrip implementations, etc.
If you want to minimize traffic to your webserver, (many hosts charge you based on bandwidth), then you want to keep the file sizes down like it was still the 1990s. That's where much of the beauty of things like scripts embedded in pages are SUPPOSED to be. (NOT the stupid %&U$#ing facebook and google analytics cross-site tracking bullshite that I see everywhere.) Scripts can alter page content locally inside the browser of the viewer, and can do so without generating more traffic. It is possible to have a surprising amount of the message body and style information for the page be controlled by scripts in the header section, permitting a LOT of dynamic content without much connection footprint.
Again, that is how scripts are SUPPOSED to be used in webpages.
(If you are really clever, and dont mind proceedural content generation, you can even generate all of your image assets on the fly instead of fetching them. HTML5 and its canvas element is very useful for that. You can make a nice looking "Landing" initial view state, and display it, while the scripts in the background conjure up the necessary visual elements for your intended page state. Once the page is ready, it then transitions the display for you. Same exact page. Total bandwidth cost= just the initial HTTP GET for the page's source. But pretty much nobody does that kind of thing, because it is time consuming and breaks easily. Just saying it can be done.)
Usually, the big goal is "optimized dynamic display of data" and "Rapid page load". EG, many different devices are going to view that page, and it needs to look consistent on all of them. But there's a problem: Not all devices use the same browser, and not all browsers are created equally. In a perfect world, browser makers wouldnt try to add proprietary features to their browsers that break standards, but they do. Web designers have to deal with that. Also, as broadband internet speeds increase, the amount of time people are willing to wait for a page to load drops. It needs to be as close to instantaneous as possible. That means highly optimized markup.