(Question after the background)
A woman passes as a man in order to study when women aren't supposed to. She falls in love with another student. Reveals to him she is female and he also loves her. But they don't end up married.
In Liang Shanbo and Zhu Yingtai (梁山伯和祝英台), both die (Romeo & Juliet?) and are turned into butterflies so they can be together.
In “Yentl the Yeshiva Boy” by Isaac Bashevis Singer, she gets the knowledge she craves, but her nonconformity results in an overall unhappy life.
In Barbara Streisand’s adaptation of “Yentl”, the ending is happier, but she gives up marrying to go where she’ll be more free to study.
I wonder whether Singer was aware of the Chinese legend?