I can't answer how common illegitimacy was in Sweden compared to other countries. Perhaps the Swedes will reply.
I saw a Swedish movie at the Swedish American Genealogist Workshop a few years ago. The story line was true, based on the parish records. The husband killed a neighbor's ox?? in order to feed his family. He was sent to prison. His wife had a terrible time without him, and ended up "giving herself" to someone who gave her food for the family. She had an illegimate child and of course the husband figured this out when he finally was released from prison. If I recall correctly, he stayed with her.
Desperate times call for desperate measures, as the saying goes. We will never know what led to many women having oäkta children.
Judy