I had something similar happen myself, albeit not as bad your experience.
While doing a warm up set of deadlifts (I think it was 120kg x 5 - I was working up to 180kg x 5, iirc), I lost my concentration for just a second on the third rep and my form broke down, leading to a pulled muscle in my back. It took me three or four months of stretching and rehab to fix it.
Squats and deadlifts are awesome exercises, but they need to be done with 100% concentration. A single second of lapsed concentration can, potentially, lead to a lifetime of problems.
I still squat and deadlift today, but I'm super careful when I do so. If things don't feel right (e.g., my concentration is slipping, the bar feels heavier than normal), I walk away and go home. I'd rather play it safe than hurt myself badly.
Out of curiosity, what do you consider a proper diet, what has been working best for you?
Admittedly "proper diet" is subjective, but what I've been focusing on is high protein, non-processed foods. For example, in the morning I'll either do a few eggs or a smoothie with fruits, vegetable protein, almond milk, hemp, chia seeds, and super yogurt. For lunch, I usually do yogurt with granola or chicken/tuna. For dinner, I just go with whatever my wife cooks. She's always focused on cooking well-balanced meals and loves to cook with fresh vegetables. One reason I think this whole thing works for me is that I'm not trying to diet -- I'm simply focusing on eating healthier foods. My biggest issue is night eating. Like many developers, I tend to work late into the night and as I get sleepy, I get hungry. The night eating got so bad with me that even if I somehow got to bed early, I'd wake up in the middle of the night starving since that's what my body learned to expect. It's been hard, but the way I've been combatting that is by eating all my meals during the day, trading in the computer for a book at night, and trying to get to sleep at a reasonable hour (11ish). I still have issues putting work down, but the combination of feeling physically better because I'm not eating chips at 2AM and rediscovering my love for reading has been wonderful.
My takeaway from all this is that certain exercises, even if you know what you're doing, may not be worth it. I was training simply to be fit - that was my goal. Deadlifts will absolutely make you stronger, but they are also incredibly dangerous if your form deviates even slightly from where it should be. Today I'm happy and seeing great results with bodyweight exercises, light weights, and a proper diet. Honestly, I feel better than I ever have besides aches in my lower back.