In regard to the first question: "What, if anything does the text say that Onan did wrong?" The answer to that is in Genesis 38:9.10 which states "And Onan knew that the seed should not be his......he spilled his seed on the ground lest that he should give seed to his brother." He refused to fulfill the so-called Law of The Manchild, to give his seed to his sister-in-law to raise up a male child to his brother's memory. God slew Onan. It would appear that Onan's sin was that of "will worship" condemned by Paul in Col.2:23. In the NT Greek, the word for it is "ethelothreskeia" with "ethelo" meaning "to will", and "threskeia" which infers "religious worship". Thayer inferred that "ethelo" implied a voluntary impulsive inclination, a prefix implying voluntary action. The implication is that of worship of self or self-will over the will of God: in other words, idolatry.
In regard to his second question: "Is it possible to draw a larger principle from this passage?" I believe so, for in Romans 1:18-28 The Holy Spirit through Paul discusses men and women given over to vile affections. In verse 26 he discusses women who gave up, voluntarily, the natural use of the man, women lusting for women. In verse 27 it refers to men leaving the natural use of the woman, men lusting for men. Notice that the scriptures establish that there is a natural use of the sexual organs implied which is vaginal penetration and ejaculation of the male into the female vagina...God ordained. The use of the term natural use implies that there is an unnatural use. Certainly that would be same-sex sexual activity, unnatural sexual activity such as sodomy, in which the sex organs are used for a purpose which God never intended, or failure to complete the sex act between a married male and female. The latter would refer to coitus interruptus or interrupted intercourse as was performed by Onan. There are those that say that his sin was not masturbation, but disobedience to the Law and rebellion against God. What most people fail to realize is that the very act of coitus interruptus or interrupted intercourse, for the purpose of preventing ejaculation into the vagina reduces the act to mutual masturbation, at least on Onan's part, for the act was purposefully entered into,by him, with an impulsive will to withdraw. She, although a victim with no intent to agree or approve of Onan's action, was reduced by Onan to the level of a masturbator/sex object, although passively and circumstantially. When two willing sex partners, male and female, are willing to practice coitus interruptus as a form of birth control, they are reducing the sex act to mutual masturbation and they are against Divine purpose, as Paul noted in using the words "natural use". The sin is that of "will worship".