It's not an either/or situation. For many years now people have been begging Mozilla to allow them to give money to help fund firefox (and only firefox) but Mozilla has refused. I can't promise that allowing it would provide all the funds they need, but certainly every little bit helps. People could continue to contribute code to the project, but that requires a lot more time, effort, and no small amount of skill compared to the time it takes to enter your credit card number and submit and an online form. Contributing code to Firefox is still a good thing, but it's a process (https://firefox-source-docs.mozilla.org/contributing/contrib...) that won't be for everyone.
There is no precedent for donations on the scale of what Mozilla gets from search licensing. The best online fundraising drive on the planet is Wikipedia with orders of magnitude more users and they don't raise half of what Mozilla spends on keeping up with Google.
It's not the panacea people keep assuming it is, it's just one of many accusations that gets flung at the wall.