There is a popular book out there about overcoming codependency, check it out if you haven't already.

Also google rescuer/victim triangle.

Reading about these things helped me a lot.

it's good that you are detaching enough to identify problem patterns in your life.