This is always an interesting topic - how sex and love has been viewed very differently in Japan over the centuries. As the article says, though, it's easy to over simplify:
The homosexual bonds between samurai meanwhile, nurtured in the relationships between a wakashū (adolescent boy) apprenticed to an older man, were considered ennobling to both and the foundation of lifelong friendships — and used to bolster existing power relationships, giving young samurai added motivation to lay down their lives for their lord. One of the most
famous examples, later depicted in the kabuki plays of writers such as Tsuruya Namboku IV, was the devotion of the 17-year-old youth Mori Ranmaru (1565-1582) to the brutal warlord Oda Nobunaga (1534-1582). It was so intense that he died alongside his lord — possibly by his own hand.
When wakashudō (the pursuit of young boys) fanned out to the more commercially minded and fun-loving middle class in the Edo Period, the number of male prostitutes soared and young kabuki actors often moonlighted as prostitutes, desired by both men and women.
There is a temptation though to see the sexual attitudes of this period as relaxed and open compared to later repressions of the Meiji Era. But it should not be forgotten that this seeming “liberalism” was operating within highly prescriptive power structures controlled by a patriarchy. Relaxed attitudes to sex and gender did not extend to anything that might have disrupted the social order — women were subservient to their husbands and adultery was a criminal offense
punishable by death (for both men and women).
The oppressive aspect of Edo Period morality is acutely depicted in the bunraku and kabuki plays of Chikamatsu Monzaemon (1653-1725). Also, the horrific consequences of adultery have been depicted in classic films, such as Kenji Mizoguchi’s “The Crucified Lovers” (1954), based on a 1715 Chikamatsu’s play.
During this period, so-called pleasure quarters were demarcated as the only acceptable areas for men to relieve sexual frustration and energy with prostitutes before returning to the fold of social conformity. Falling in love with an indentured prostitute often had fatal consequences — the plot of many tragic works including Chikamatsu’s 1720 play “Shinju Ten no Amijima” (“The Love Suicides at Amijima”).
In the name of order, the ruling shogunate watched these quarters closely to ensure they did not exceed certain bounds. The Edo Period saw a long stream of edicts by the shogunate proscribing immoral behavior, including the banning of licentious books and art works