Edit: my mistake, the first custom-styled switch example isn’t the full example. I realized that after I commented. Original comment below for posterity. It doesn’t apply to this case, but I think it’s still relevant as I’ve encountered the mistake I thought I was seeing in “you don’t need JS” contexts pretty frequently. In any case, sorry I misunderstood the example in the article.
The custom-styled switch doesn’t work on iOS Safari. It certainly can work without JS, but this kind of mistake is potentially informative in evaluating whether it should.
That’s not to say “if you want a custom-styled switch, JS is a better way to achieve that.” But if you’re already starting from the premise that HTML has a functional equivalent, it’s okay to use that for the default behavior and enhance it with JS to ensure it’s interactive when it’s enhanced with CSS to satisfy a non-standard design.