How do I install an old work junction box around fire blocking?
A horizontal board between two studs is typically fire blocking. The idea of fire blocking is to prevent a cavity in a wall more than 8' high where fire can quickly spread. You'll see this in any room with over 8' ceilings. For it to work properly, you can't have any gaps allowing air to go from the lower cavity to the upper one. This means any gaps need to be caulked with fire rated caulk (that's typically the red or orange caulk). Why the heck someone installed this blocking and electrical box in the same place is bizarre, either one could have been moved up or down a few inches.

To work around this, you have a few options. You can cut a gap into it, and fit your old work box, but from the small opening you'll have a very difficult time cutting out the back. The result will require a load of caulk on the 2x4 that you squeeze the old work box into. And you'll need to install it a few inches to the side so there is some material continuous from side to side.

You could also fix this the right way and open the wall up, and reinstall new blocking a few inches up or down. Then you can remove the old blocking and install a new work box.

And the easiest solution is as DA01 says, install the new switch a few inches higher so it's above the blocking. I'd probably go with this solution myself, unless you feel like doing some drywall repair.