I think wrong livelihood for lay-people is narrowly defined in the suttas -- in AN 5.177:
Monks, a lay follower should not engage in five types of business. Which five? Business in weapons, business in human beings, business in meat, business in intoxicants, and business in poison.
"These are the five types of business that a lay follower should not engage in.
Ven. Sujato translates the same slightly differently:
Mendicants, a lay follower should not engage in these five trades. What five? Trade in weapons, living creatures, meat, intoxicants, and poisons. A lay follower should not engage in these five trades.
I've read modern commentators expand on that to add it should be an "honest" living, not based on fraud or deceit.
There's a slightly related topic here: Is it ethical to develop software for financial company?
I think the consensus there was that if you develop some product (other than one of the five proscribed) you're not necessarily blame-worthy if some people mis-use it.
Another related topic might be all the ones which ask about vegetarianism including for example Why is contributing to the market demand for meat not wrong? -- and opinions seem to differ, with some people (and some schools of Buddhism) saying that buying and eating meat isn't blame-worthy because in doing so you yourself don't have the intention to kill (and other people or schools disagreeing).
Another question might be, what do you mean by "alleviate suffering of humans"? I've now chosen to work for a company that produces medical software (used in hospitals) instead of "financial technology" -- and I don't regret that choice, I don't know a better one -- but that (i.e. medical technology) isn't exactly the type of "alleviating suffering" that Buddhism is about (Buddhist "suffering" might be more about the second of the "two arrows").
Another topic from modern history -- apparently Nazis performed immoral medical experiments on humans, is it immoral for others to use the results of those experiments? That's an extreme scenario (though "animal experimentation" might be considered extreme also), and therefore perhaps not a good way to think about everyday morality, but perhaps it introduces another topic that's been discussed on this site, i.e. the so-called trolley problem.
Answers like this one might imply that lay livelihood is a no-win scenario and might help provide insight into why some people choose to live as monks instead.
In summary you're conflicted, and I'm not sure that the suttas provide an easy answer to your question. If the "vegetarianism" is one of the closest topics, people and schools seem to differ:
- Some people have what seems to me a "compartmentalised" view (like "my paying the butcher doesn't mean that I want to kill"), which I find hard to understand
- Other people have a broader view (like "all types of agriculture results in some animal deaths"), which I find hard to deny
Personally I am vegetarian, I think that means not that I'm especially virtuous but I'm fortunate or rich to live in a society where that amount of choice is even possible. I have "actively avoided" (as you say) working for companies in the "defence industries", so I'm happy (or to some extent conceited) about having done that. But I'm working in the medical industry, which depends on some animal experimentation -- not the company I work for, but the industry as a whole -- so to some extent there's no avoiding it.
So I'm not sure how you'll want to draw the line. I feel at peace with my decision, to use my experience as a telecommunication software developer to develop medical software.
Samana Johann wrote in this answer:
So once feeling involved, doubt of ones goodness arises, it's good to lesser seek excuses to continue as usual but look for changing toward proper livelihood.
In his case his own choice of "proper livelihood" is presumably that of monk, not lay-person. Perhaps we're both agreed that "freedom from remorse" is important -- fundamental -- my own decision was that it's better (less regrettable) for me to work like this than not.
There are some more extensive articles including one with an author's discussion of (or opinions about) Right Livelihood, on this page: The Buddhist Layman.