Kinda.... you want to be mindful of the place where you ask for the color change to take place. For example.. layer 37 its close to 7mm high considering a 0.20mm layer height. So, you can prime anyways.
With your code, its going to ask for the nozzle to move down (or up) to Z10, which may end up with the hot end hitting whatever you printing.
typically you will have plenty space to prime as long as your not changing colors in the first 8 layers.