I did a a good bit of Yoga in my 20's and there are a lot of good reasons for it in my opinion. But I have to say, I've never stretched before or after a bike ride and it's not something I'd recommend.
For tight hamstrings try some runners stretches. I associate being loose with generally being in better shape, so some running maybe or time in the gym, or even better your preferred active sport if any.