I'm not so experienced but I'll still give my thought on the subject
Both your problems programming related.As Matt Wenning said ''It's not what you do,it's what you can recover from''
So let's say you were to design a program for yourself right now.How would it look like?
1.Would you balance all the pushing you do with pulling movements?
2.Would you program in weeks where you take it easier or just wait until you started feeling like shit?