

Apple recently removed the USB-A only SuperDrive, and replaced the Magic Mouse with a USB-C variant.
Other than perhaps old-stock, the only current Lightning device Apple is currently selling anywhere is the iPhone SE, which appears due for replacement soon.
Short answer — the internal “switch” is held in the on position by a magnet. Magnets become much less effective when they get hot, and while there is still water in the cooker the maximum temperature will be 100C. Once all the water boils off the temperature quickly rises — but the magnets stop being able to attract the switch when they hit around 102 - 103C or so and release the switch, turning the machine off.
So all has is a switch connected to a magnet next to the bottom of the pot. That’s it. Physics does the rest.