There are two possible counter possibilities:
First possibility:
In case the rooting is done by scripts and certain binary tools you can check if the binary tools are standard tools, and e.g. included in the Android Open Source Project (AOSP). In such a case you could compile the tool yourself or search the net for multiple sources. In the ned use the one from the most trustworthy.
Second possibility:
Use a virtual machine for executing the rooting software. Using a virtual machine like VMware you can connect an USB device like an Android phone into the guest OS. Therefore rooting the device from within the guest OS is usually possible and does not affect the host OS.