I experienced something similar, but with my hip. I needed hip replacement, but many doctors wouldn't do it b/c of my age. They said I was too young in my early 40's. In the meantime, I gained tonnes of weight b/c I couldn't walk and do normal everyday activities. One doc told me to lose weight and my hip would feel better, the problem was, I couldn't do any exercise b/c it hurt so much.
I finally had the hip replacement last year and the difference is amazing. I started exercising at the Y and started eating better. I went to the doctor and I had gained 20 pounds since she weighed me last prior to the surgery. I couldn't understand it.
She did a full workup and turns out I was pre-diabetic. If your glucose levels and A1C are out of whack, it's literally impossible to lose weight for some people.
I suggest you go to your primary doctor, explain your symptoms and get an exam, including blood work plus your hormones checked.
I'm not a medical professional. Just someone who experienced much of what you have described. I understand completely the pain and frustration of your knees. I was so depressed because of my hip. Have you seen an orthopod and is knee replacement an option for you? If you have seen an orthopod and he says to lose weight first, go to another and another until you find a doc you like and trust who will do it - if that's what you need.
I firmly believe if I wasn't turned away by so many doctors, I wouldn't have gained so much weight and in turn become diabetic. None of the docs looked at the bigger overall health picture for me.