I'm sure there are ton of ways to do this. I'm not even sure if screwing from inside the box would meet code. Another reason to do it after the fact is because you can potentially line things up better. Once you put the box on the stud and drywallers cut the hole, you are done. If you wait until after you can center stuff, have it higher or lower or whatever after you know what you have...
More like
this (but nevermind the thick walls).