Thank you everyone for replies

.
I managed to heal my wrists in a few days by resting, using cooling gel and giving my hands hot and cold baths in turn. Now the symptoms are gone and I'm able to play normally again.
I thought I'd share my findings in case anyone ever searches the internet for an answer on how to heal carpal tunnel syndrome and how to play without causing injuries. Here are some of the reasons I developed tension and I hope they might help someone else fix their wrists, too:
1. I played too much
I used to play 3 hours every day. I've only been playing for 2,5 years and while I'm at the intermediate level, I haven't accumulated the necessary stamina to maintain a good hand position or the correct body posture for more than c. 30 minutes at a time. Bad hand position (in my case, wrong thumb position) leads to tension. Slouching, leaning forward etc. will put pressure on your hands.
2. I tried to control every aspect of my playing
I developed tension because I was overly conscious of my technical faults. While it's good to be aware of problems in your playing, I think it's healthy to accept your playing as it is and make one small change at a time. Trying to control every little movement will definitely lead to tension. Worst of all, I ended up constricting my natural, instinctive body movements. My teacher told me: the less you think, the better you play. That's because the hand will find its way if you allow it to move in a natural way. Branding your playing as hopelessly bad (which perfectionists tend to do) will lead you to undermine what you already have.
3. I focused too much on technique
For me, tension appeared when I began to over-emphasise raw technique and forgot to enjoy music. Letting yourself go and allowing your body to move to the music while you play allows you to relax and find the best ways to move your hands and body in a way that allows for the right kind of sound to come out. Your natural movement is obviously not perfect as it is but it's the only place you can start, really.
In conclusion, my problem was definitely over-thinking. Developing tension doesn't necessarily come from doing everything wrong and having a bad foundation: it can also be caused my mental tension and trying too hard. I've come to terms with the fact that I'm not perfect and will not ever be a perfect player. I prioritise expression and enjoyment and believe that this attitude will also ultimately lead to a better technique as well.