Same-sex relationships existed in the culture, and if you consider male Kabuki actors presenting as female in their everyday lives, as the famous Kabuki actor Yoshizawa Ayame did, there was at least a conversation to be had about transgender identity.
At one time, long ago, Japan had fairly open attitudes towards gender and sexuality.
Queerness in Japan has a tumultuous history.