I did this for a long time and then started working with a trainer who pointed out my hamstrings were likely super weak compared to other muscles and he was correct. So I added a leg machine and some other exercises that made my workout hit the muscles the main lifts mostly skip. But I agree, if you want to get strong go to the gym and be consistent. Nothing else works.
Both deadlifts and squats work the hamstrings though. But sure, you can definitely add some exercises if you feel the need for it. I've personally never really worried much about hamstring strength. I'm basically just trying to maximize the gain while minimizing the actual gym time. Then I spend the rest of my time doing other things I enjoy more such as rock climbing and hiking. I've also dabbled a bit with running/jogging recently.
Oh I used to feel this way and then I realized I rather enjoy talking nonsense with my trainer and then pushing for maximum gains. I can definitely tell my enjoyment goes up when working out with a trainer or another lifting partner mostly because of the encouragement.
I had the same problem. I think a lot of people reading this will have weak hamstrings. I think it's a natural consequence of desk work.
Adding in some Romanian Deadlifts really forced me to focus on my hamstrings when doing lifts. It helped me breakthrough some plateaus with the conventional deadlift.