Would it be better to be tortured for years? To have your family knowing that your fingernails got ripped out? That you lost your genitals to electrocution?
I'm not sure. Plenty of heroes committed suicide.
it does raise an interesting, if morbid question. personally, I think it is fine for someone to kill themselves (or receive assistance in doing so) if they are facing a near certainty of terrible suffering for the rest of their life. the tricky part is the "certainty" bit. many people experience varying degrees of suffering at some point in their lives, but it is uncommon for it to persist throughout their entire lives.
if you are interested in a way to sidestep this specific question, I would point out that the pills are not only for the benefit of the pilots. the measure is also to protect others who might be harmed by information divulged under interrogation.
as for why the pilots in particular, my (fairly uneducated) guess is that pilots inherently have knowledge of more sensitive information than a typical infantry person. while the soldier probably only has knowledge of local troop movements that will be stale in a few days (most US infantry standard procedures and equipment details are public knowledge), the pilot may know classified information about the aircraft they are flying.
[0] https://www.usnews.com/news/articles/2015/02/19/suicide-pill...
-- E. Cioran
The trouble with "death means salvation", and believe me I know that yearning, is that you don't get to experience this salvation. Suicide is literally not the answer, because you will never get to experience the relief on the other end. This is the essence of Cioran's quote here. It would have been better to not exist, but it's too late for that now and ceasing to exist will not, in fact, afford you any sense of relief. The only relief you feel is in the fantasizing about death itself.
Eventually you will die and after that point it won't matter how long or how painfully you've lived. From the perspective of death life doesn't matter at all, but you won't be alive to experience that perspective.