No need to laugh or judge. Yes, your best move was not to get married and save yourself the legal battles. As for the reasons why you stuck around for 20 years, there is a whole book on psychology we can open up and analyze, but we don't have to go there.
I too stuck around for longer than I needed to and finally called it quits after 19 years. It was the best decision of my life. I was married and wouldn't wish divorce upon anybody.
There is a lot of healing to do after such a long time span. Be kind to yourself and believe that you did the best you could given the circumstances.