Always take around 15min from you exersise plan to stretch, when you stretch you need to hold that stretch for around 1 min to get the best results. If it still hurts either higher someone else to help with the pain or change your exersise plan so it hurts less. Remember to always let yourself rest.
Low impact moves! Your doctors have some grain of truth in that movement heals. Movement IS medicine. However, they shouldn’t be prescribing you to “push thru it” if this problem has been as persistent as you say. Low impact is the way to go. That means no jumping or running. However, cycling or swimming for just 5-10 mins is a perfect example of something that will get you feeling fit and strong but won’t aggravate your pain areas. Also there are exercise apps that let you select intensity and low impact options to both get out and move yet still remain safe about it.