Just a thought from a random stranger but you might want to consider the possibility of celiac disease. It takes a couple months for antibodies to build up so the time scale you mentioned here stood out to me. Celiac disease has huge impacts on mental clarity and energy.