Ethically?
This is essentially the Nuremburg Defense, but it's "just following money" rather than "just following orders".
Unless we reach some magical Utopia, we will always have the choice between making money through ethical or unethical means, with the former being beneficial to society, and latter being more lucrative to the individual.
It's a rather reductive and defeatist view. There's nothing more harmful than looking at a specific state of affairs and going "eh, that's just the way the world works", as if our current economic system was an immutable law of nature.
The brightest minds are working on ad-tech, not as an immutable law of nature, but because that's where the incentives are, and if the parent commenter wants that to change, whining about how the OP isn't more charitable won't solve it, like whining that open source developers don't work on what users want instead of what they want won't change it; If it's all about incentives, we [1] should look towards finding a way to incentivise the more desired outcome.
[1] parent commenter alone, or society generally.
I think it goes something like the Open Source saying "that person doesn't owe anyone their intelligence to work on so-called important problems for free, just because it might be nice if they did".
Want smart people to solve important problems? Find a way to pay more for that, than for ads, or find a way they don't need to earn money to live at the standard they want.