The vast, vast majority of people who work with wordpress never have to see the code, beyond some settings in a config file. You have to not think about it as a developer and think about it as a consumer who just wants "a site" with themes and plugins that "just work" (and with wordpress, they mostly do.)
Although as a developer, I agree - the code is pretty awful, even for PHP. But... small business owners, bloggers and such couldn't care less about that.