Indeed. There is a pocket where the thermostat sits, and the terminals to the element sits on either side of it. The thermostat itself has a long prong going into this pocket, and two terminals that connect to the element as you push it in. Then the wiring connects to the back of the thermostat. You can replace the whole shebang without draining the geyser.
Some heat pumps have a retrofit sensor with a really thin wire that you slide down to the bottom of this tube, while leaving enough space so that the original thermostat can still sit inside the same tube (being careful to nick said thin wire of course).
If you are not using the thermostat, I would think you could pull it out and put the heat sensor connected to your sonoff down the same hole. With or without the heat pump’s sensor (if you have that).
Otherwise, you can also just put it right against the flange. Heck you could probably put it under the lagging on the pipe at the top/bottom too and you’d get a reading, since the piping itself leaks some of the heat. You’d just not get an accurate reading, since the moment you use any hot water the bottom goes ice-cold immediately, while the top may remain hot right until the last hot water is consumed