I could easily throw that sarcasm back on you, but I'll bite my tongue
My point was that I was being sympathetic that, like myself, you've bought a house that comes with electrical installations that are clearly in breach of electrical regulations. It happens often, sadly. And often that sort of mistake is made by people who really ought to know better, i.e. tradesmen!
I can't comment on your original question because I do not have the relevant knowledge, hence saying 'no idea'.
Had I thought that you'd wired that yourself, my comment would have been to the effect that exposed cable cores outside of an enclosure are illegal and dangerous, and so, while you're about it, get a backbox to fit behind whatever you replace that thermostat with and make a real improvement.
Better still, if you are going to do DIY electrics and you do not know that cable cores need to be in a cable sheath or enclosure everywhere, then you really need to get a good textbook on the subject and read it cover to cover before you start. You just won't always get the level of instruction you need from websites. This textbook is quite a good one, I think:
The Electrician's Guide to the 17th Edition of the Iet Wiring Regulations BS 7671: 2008 Incorporating Amendment 3: 2015 and Part P of the Building Regulations