You're totally right, if a page is merely serving static content with hyperlinks between the pages. For many types of pages, however, that's not the goal, and using JavaScript makes sense. Think of an interactive data visualization, where nearly the entirety of the content depends on dynamic user input controlling aspects like filtering and highlighting.
There are many cases where developers use JavaScript when plain CSS and HTML would do, but there are also many pages that simply do not fit that simple model. And between those two extremes is a large space of application with a mixture of static content and interactivity. Don't focus on a single usecase and ignore the rest.