What about hiring a nutrition coach to evaluate your diet?
First, I would follow a strict standardized program for a few months to reduce the number of variables and try to sleep, workout, etc. at the same levels for 3 to 6 months. Then,
1. Check T levels.
2. Increase protein, especially breakfast. Walk around after meals for better digestion.
3. Try a hypertrophy focused plan like BuiltStrong for 3 to 6 months to see if that makes a difference.
BUILT STRONG | StrongFirst
This will validate whether putting on muscle is in fact a problem or there are other factors involved.
5. See a different doctor
6. If financially feasible, consult a professional trainer with nutrition education.
7. If you live near a university, contact the faculty to see if they would be interested in studying your problem. Researchers are always looking for good research problems for their grad students.
The scientific method and Sherlock Holmes approach would be to try to eliminate factors one by one until you find the answer.
1. Does protein increase make a difference?
2. Are T levels normal?
3. Are there any gastrointestinal problems?
4. Can you build muscle?