No there is no direct way to build the code for model reference block. If you want to generate code for only the model reference block then you will have to put it into a subsystem. You can always put the model reference inside a model and build the entire model.
Now, when you want to generate code for only the model reference block, there is no clear understanding as to how the code will interface with other blocks or inputs & outputs. When you put the model reference inside the subsystem, you create a boundary interface to interact with the internal logic of the model reference. Its a very subtle point, about the interface to communicate with the block logic upon code generation.
The short answer to the question is, yes, you have to add the model reference inside a subsystem to generate code for it unless you are building code for the entire top level model. When you are building code for the entire top level model then, in a way, you have already taken care of the interfacing component.
Best Answer