I am the maintainer of Red Moon, a FLOSS screen filter app for Android. Over a period of several years, the location of the toggle has moved from a switch at the top, to a switch and a floating action button (FAB), back to just a switch, and will soon move to just a FAB.
I can provide more detail later if someone would like, but the short of it is:
1) As other features changed (permission prompts and moving the growing number of settings to their own screen), one location or the other made more sense.
2) I thought I would like the single top switch better than a single FAB, but after using it for a while, I think the switch feels more confusing than fresh (the action bar is a nonstandard location for a switch).
Overall, I would say it's because design is really hard. But not like that! It's hard because when you spend so much time close to a system, you start to overthink things, and then second-guess yourself. So you can't trust your intuition, you need to listen to users with fresh eyes. But they're also telling you 5 different, conflicting things, and if you listen to everyone you'll have a settings section 9 miles long. You can try to rely on data, but that's mostly good for reaching a local maximum, not staying cohesive. The best designers are able to keep their "fresh eyes" even after working with the system for a long time.