Triple or nothing paradox

You are at a cas­ino. You have $1. A table offers you a game: you have to bet all your money; a fair coin will be tossed; if it lands heads, you triple your money; if it lands tails, you lose ev­ery­thing.

In the first round, it is ra­tio­nal to take the bet since the ex­pected value of win­ning is $1.50, which is greater than what you started out with.

If you win the first round, you’ll have $3. In the next round, it is ra­tio­nal to take the bet again, since the ex­pected value is $4.50 which is larger than $3.

If you win the sec­ond round, you’ll have $9. In the next round, it is ra­tio­nal to take the bet again, since the ex­pected value is $13.50 which is larger than $9.

You get the idea. At ev­ery round, if you won the pre­vi­ous round, it is ra­tio­nal to take the next bet.

But if you fol­low this strat­egy, it is guaran­teed that you will even­tu­ally lose ev­ery­thing. You will go home with noth­ing. And that seems ir­ra­tional.

In­tu­itively, it feels that the ra­tio­nal thing to do is to quit while you are ahead, but how do you get that pre­dic­tion out of the max­i­miza­tion of ex­pected util­ity? Or does the above anal­y­sis only feel ir­ra­tional be­cause hu­mans are loss-averse? Or is loss-aver­sion some­how op­ti­mal here?

Any­way, please dis­solve my con­fu­sion.