These two uses have subtly different meanings.
"It has been years since I wrote my brother." Simple statement of fact that exists up to the present moment.
"It had been years since I wrote my brother (before he called me out of the blue)." The "had been" implies that something happened afterward and whatever condition was true before is now in some way resolved.
With that out of the way, the use of certain tenses with "has/had been" doesn't always make sense. "It's been years since I had ridden a bike" is mixed tense. The "it's been" implies an ongoing condition, but "had ridden" implies a past condition.
In the same way "It'd been a whole two hours since he texted me," is OK, but again we're talking about a past condition that at that moment should be resolved. "It had been a whole two hours since he had texted me (and then something else happened)." We tend to make this less formal by using the simple past tense, but it's not really proper English.
"It'd been way too long since he has had sex." You're mixing tenses again. "since he has had sex" implies an ongoing condition, but "It had been way to long" implies a past condition. You have to decide which is true:
"It has been way too long since he has had sex,"
"It had been way too long since he had sex,"
"It had been way too long since he had had sex."
The first one implies ongoing condition. The second two imply a condition that since has been resolved. The third one is actually good English, but in common practice the double "had" is condensed into one.