At some point, high grade cancer (pattern 4 or 5) in the prostate undergoes a genetic transition called epithelial-to-mesenchymal transition (EMT). Unlike the epithelial cancer cells within the prostate, which die quickly outside of the prostate, mesenchymal cells have the ability to exist outside of the prostatic environment. They can travel in blood, lymph and possibly along nerve pathways. They also have the ability to clump together to form tumors.
This is different from cancer that grows into surrounding tissue, bringing its environment along with it. That kind of invasive tumor can be any Gleason score from 6 to 10. But in tissue left behind, it can later progress as above.
Here's an article about
spreading PC by invasive procedures:
Can invasive procedures spread prostate cancer?