"The problem is CSS has a global scope".
CSS can be written in a way that it affects only specific parts of the site/app.
"you change one thing and breaks the whole site's layout".
There are use-cases when you want changes to reflect across the entire site and CSS can be easily used to achieve it. (Ex: changing color of buttons).
Javascript can also break the whole site's layout. It just depends on what code we write.