You simulated the limiting case, where you don't stop having babies until you get a boy. That's (obviously) not realistic as we have a finite lifespan and fertility, but note that the
expectation still holds.
In this process you will always get 1 boy, obviously. But you have a (1/2)^k * (1/2) chance of getting k girls before your first boy. Thus the expected number of girls is
Sum[k * (1/2)^k * (1/2), k, 0, inf]
which is 1: https://www.wolframalpha.com/input/?i=Sum%5Bk+*+%281%2F2%29%... .