As an analogy there are usually many different roads from one place to another. Depending on which roads you select, you have different routes to get to the same place.
When you generate the G-code via a CAM program there are many solutions to carve a design. It is the CAM program’s function to select a path to carve and it is usually affected by the Post Processor and the CAM program’s options that the user selects.
The only way to get matching G-code files for a particular design, you have to use the same CAM program with the same options and Post Processor.
$12 only comes into play if your CAM program produces G-code with G2 or G3 commands. When the sender program sends the G2 and/or G3 commands to grbl, $12 applies to all of them the same.