It’s mathematically sound because you do guarantee a net positive with enough of a bankroll. As I have mentioned in other comments here this is not a strategy that can be used in the real world.
You even admit it would work with absurd amounts of money… The math works.
The math doesn’t work because given enough rolls you literally always go bankrupt no matter what bankroll you start with. Take the simplest option a fair coin where you win on tails and lose on heads. Real actual random flips will contains runs of heads. Let N be the number of rolls required to bankrupt you for any value of N. The more you roll the more the probability of such a run increases towards 1.
You could end up bankrupting a billion dollar bank starting with 10 dollar bets. It’s only sound if you have a literally infinite bank. For any finite bank you just have to play longer to lose but you always end up losing.