Rachel and I were talking about this issue yesterday, and I think there's a "more correct" answer here. Like Rachel mentioned, redefining blocks at runtime is somewhat problematic (What do you do if you redefine a block in the Toolbox, but there are already blocks in the workspace?) However, I don't think you need to. I think you should just change the definition of your block. The "default" blocks you'll find in
the blocks folder are not required, they're just defaults. If you want custom behavior on your variables block, you should swap out the block definition. There is one quirk about variables - the only blocks that will go into the variable category are "variables_get", "variables_set", and "variables_change". So, if you're using the block definition files directly, you should replace the definition of "variables_get" in
variables.js. It is important (for now) that it has that name, but the definition can change easily, as long as it still has a variable field. If you're trying to avoid merge conflicts, I might suggest to define "custom_variables.js" as a copy of variables.js and include that one in your project (or in your build file, if you need blocks_compressed.)
You're right - variables_ get, set, and change are hard-coded several places in the code base, and I'm increasingly feeling like we need to add a mechanism for changing that. But I think the "right" way to deal with this is to change the definition of the variables_get block at the JSON level. That will remove the error, and while there may be a merge conflict down the road, we strongly encourage custom block definitions for basically every application, so it would be the place they are the most appropriate.