I once had hamstring soreness/tightness, combined with hip bursitis. PT diagnosed it as weak gluteus medius/glutes not firing when I ran. She had me do single leg glute bridge raises (theraband at knees), clamshells, single leg deadlifts, monster walk, and hamstring curls.
My hip issues resolved in 6 weeks ish, but my hamstring pain lingered UNTIL I started doing hamstring curls on machines at the gym. Deadlifts help, but they just don't target the bicep femoris like extended hamstring curls do. Bicep femoris is the part of the hamstring that engages at the START of the pulling motion. It snaps the foot back, and then the rest of the hamstring muscles kick in and continue/accelerate the motion, all the way to push-off. After about 4 weeks of doing hamstring curls 1-2x/week, the pain was gone. No soreness, and my hamstrings felt great.
Look, there is a time for rest, and a time for re-building muscle. Too much rest just leads to muscle atrophy. Most sprains heal in about 6 weeks. Plus, the hamstrings are really poorly designed muscles on the human body. They do not get a good supply of blood, especially if you are sitting on them most of the time. They respond well to being lightly active.
Remember this when it comes to muscle tears: our muscles are made of many small fibers. When we tear them, sometimes they heal badly. Instead of lining up like a row of dry spaghetti, instead they end up like cooked spaghetti on a plate - all over the place. They fuse like this, and soreness/tightness remains in a muscle. The muscle needs to be selectively re-torn gradually so that the fibers can heal straight. Eccentric muscle contractions help this (which is why eccentric heel drops are the protocol for achilles tears). Massage also helps with these muscle tears that don't heal properly. But massage doesn't increase the amount of muscle fibers or strengthen the muscle. It just increases blood flow and breaks up the scar tissue.
You could try doing some hamstring curls on the machines at the gym. The kind where you lie down on your stomach, and pull your feet behind your butt. Lift the bar with both legs, then let it down with the injured leg. Start small - 10 lbs. It should hurt, but feel like manageable pain. Not excruciating. Don't do any huge volume. Just 2 sets of 20 reps - do both legs. Plus some of the other stuff I mentioned above would help with overall stability.
If you are unsure/don't have access to a gym, just go do a drop in sesh and try it out. After one session you should feel some 'changes.' Your hamstring will feel a deep "good" soreness, rather than a sharp, pinchy soreness. In a few days, you can do it again and it should feel easier/less painful.
I am NOT a PT, but this is what worked for me. I strongly believe in pre-hab, so I continue to do hamstring curls 1x/week. If I slack off, and maybe go every other week, the hamstring pain returns.