We also rely on the gluteus medius when balancing on one leg - not stretching and allowing it to feel "tight", can lead to back pain and pain when walking.
Do these stretches when you're warm - after a workout or a walk, when your muscles are pliable and you're not risking strain. If you feel any pain, stop! Discomfort is different - grit your teeth!
There are two trigger points for the glute medius - pressing them and massaging into these areas can relieve tension and pain in the back and glutes. Try holding for 10 seconds, releasing and repeating as necessary!