eh, I didn't really take either that way. I just remember 40 Year Old Virgin being funny but was not reading any overall morals into it. I don't really remember details at this point, I just took it all as a running joke and some guy looking for his own personal happiness.
For Good Will Hunting, I felt like it was just saying that obsessive behaviors that dominate your personality can make you pretty angry and unhappy, and there's something to be said about 'stupid things' like relationships even if they don't make sense to you. I don't necessarily think Minnie Driver was going to cure Will's problems. However, it was a big deal for him to do something "illogical" that involved him placing some trust in another person rather than being so stubbornly self-reliant and walled off relationally from others. This is why his relationship with Sean was so powerful, it was another relationship that he was treating as adversarial rather than as a chance at connection. yeah, Sean did obsess a bit over "intimacy" because he had such a powerful relationship with his wife and maybe that's the lens through which he viewed the world, but it doesn't mean he didn't have something that Will needed to hear.
The big moral for me wasn't that he went after Minnie Driver per se, it was that he took a risk that wasn't all just dependent on himself being the smartest or the most capable; it was way outside his comfort zone; it was something he wasn't naturally the best at. The relationship might not work out regardless, and that would be okay. The thing is that he took a RISK outside of his comfort zone and one that involved another human being.
Ben Affleck's buddy says as much: "“Every day, I come by your house and I pick you up. And we go out. We have a few drinks and a few laughs, and it’s great. But you know what the best part of my day is? For about 10 seconds, from when I pull up to the curb and when I get to your door, ’cause I think maybe I’ll get up there and I’ll knock on the door and you won’t be there. No goodbye. No see you later. No nothing. You just left. I don’t know much, but I know that.” He knows Will is just wasting his life and in a rut because he likes being a big fish in a tiny pond, when he could be so much more, partly because he's just so unhappy and angry all the time -- and his buddy needs to just get out into the world and take some chances to liberate himself from that.