As a historical fun fact, before 1946, Japanese kana spelling was actually way more confusing. For example, きょう was spelled けふ, とうきょう was spelled とうきやう, かし was spelled くわし, etc., etc, despite the pronunciation being the same as the current one. In 1946 they introduced the modern largely phonetic spelling, although some exceptions were made. The particles は, へ and を were deemed too common to change so they keep their older spelling.
See https://en.wikipedia.org/wiki/Historical_kana_orthography for details on this.