A buyer can easily outbid an all cash offer.
In fact, if you offer 100% over asking price you’re almost guaranteed to win ;)
There are situations where it definitely makes sense, like if you're pretty secure without the bonus, you're friendly with the people deciding the bonuses, the base salary is high enough, there is some guaranteed minimum bonus, and you don't burn out trying to attain/maximize it.
Ultimately, you can't get away from the fact that some financial health is at the whim of persons within the company and frankly they just aren't going to care as much about it as you do. It's very much a gamble instead of a solid investment.
Making a lot of money is great until it doesn't come for whatever reason.
It should go without saying that you shouldn't take out a mortgage where you can't afford the regular payments out of your regular income. Banks are very unlikely to grant you such a loan anyway.