those loopholes are the fence around the Tora?
That is essentially correct. The torah itself is sacrosanct, and Rabbinic derivations are not seen as loopholes, so much as expert notes to aid in understanding the intent of the torah and accidentally violating the letter of the law. The really short version is, god is omniscient, and therefore knew when he spoke how his words would be interpreted for all time, and so if he didn’t want people to interpret them a certain way, he would’ve said something different. In other words, following the letter of the law is integral, but rules lawyering is not just allowed, it’s expected. There’s actually a famous jewish parable about a time rabbis exiled god himself from a debate because if he wanted to influence the proceedings, he should’ve done so in the torah.
“The torah says we can’t start a fire on the sabbath. But what counts as ‘fire’ or ‘starting’, exactly?” “The torah says we can’t carry a heavy object more than 4 cubits while outside our private domain on the sabbath. What counts as heavy? What is a private domain?”