Let $N$ be the number of flips needed, and let $E(N)$ be the expected number of flips needed. You always need a flip, but with probability $\frac{1}{9}$ you will not make progress and need to "start over" and flip again, with another $E(N)$ expected flips needed to finish. So
$$E(N) = 1 + \frac{1}{9} E(N).$$
Solving for $E(N)$ gives $\color{blue}{E(N) = \displaystyle\frac{9}{8}}$.
I ask you for additional explanation. Meanwhile I'll post here another approach.
Denote by $\tau_i^5$ the random variable that counts the time required to get five heads starting from $i$ heads, ok?
What we want is exactly $E[\tau_0^5]$, right?
Now, you can evaluate $E[\tau_0^5]$ conditioning at the first step.
$$
E[\tau_0^5] = \frac{E[\tau_0^5]}{2} + \frac{E[\tau_1^5]}{2} +1
$$
Explaining the equation above. With probability $1/2$ you have a tail, so the time you will take to get five heads is the same, because you have any heads. On the other hand, with the same probability you get a head, and now, the number of flips needed to get 5 heads is $E[\tau_1^5]$, because now you that you have one head. The +1 it is because you have to count the first step.
Repeating the argument above you get
$$
E[\tau_1^5] = \frac{E[\tau_0^5]}{2} + \frac{E[\tau_2^5]}{2} +1
$$
Proceeding this way, and remembering $E[\tau_5^5]=0$, you get
$$
E[\tau_0^5] = 62
$$
This may seems more complicated at the first sight, but the idea of "to conditionate at what happens at the first time (or movement)" solve a big variety of problems.
Best Answer
Let $N$ denote the total number of flips in the game, $N_A$ the number of flips of player $A$ and $N_B$ the number of flips of $B$. Furthermore, denote with $H_A$ the number of heads flipped by $A$. We seek
$$\mathbb{E}[N]=\mathbb{E}[N_A+N_B]=\mathbb{E}[N_A]+\mathbb{E}[N_B].$$
Note that $N_A\sim\text{Geom}\,(1/2)$ so $\mathbb{E}[N_A]=1/(1/2)=2$. Also, $$ \mathbb{E}[N_B]=\mathbb{E}[\mathbb{E}[N_B\vert H_A]]=\sum_{n=1}^\infty\mathbb{E}[N_B\vert H_A=n]\mathbb{P}(H_A=n)=\sum_{n=1}^\infty\mathbb{E}[N_B\vert H_A=n]\left(\frac12\right)^{n+1}. $$ To compute $\mathbb{E}[N_B\vert H_A=n]$, consider the trivial case $n=2$. How many flips does $B$ need to make to obtain $2$ heads? The first head follows a geometric distribution and so does the second. In general, the sum of geometric R.V.s is a Negative Binomial with parameter $n$ and $p$, therefore the desired expectation is the mean of a NBD, $$\mathbb{E}[N_B\vert H_A=n]=n/(1/2)=2n.$$ It follows $$\mathbb{E}[N_B]=\sum_{n=1}^\infty2n\left(\frac12\right)^{n+1}=\sum_{n=1}^\infty n\left(\frac12\right)^n=\underbrace{\sum_{n=1}^\infty n\left(\frac12\right)^{(n-1) }\frac12}_{\text{mean of Geom(1/2)}}=2.$$ Thus, $$\mathbb{E}[N]=\mathbb{E}[N_A]+\mathbb{E}[N_B]=2+2=4.$$
Edit:
I misread the problem, the above works for player $B$ flipping $H_A$ heads in total, not in a row. It suffices to make a small adjustment. Let us make a slight generalization. Denote with $X_i$ the total number of successes attained up to the first time there have been $i$ consecutive successes, and with $A_{k-1,k}$ the number of additional successes aftet there have been $k-1$ successes in a row until there have been $k$ in a row. It follows $$X_k=X_{k-1}+A_{k-1,k}\implies \mathbb{E}[X_k]=\mathbb{E}[X_{k-1}]+\mathbb{E}[A_{k-1,k}].$$ Now, note that if we have accumulated $k-1$ successes and if the next one is a success (with probability $p$) then we are done, if not, we start all over again. So $$\mathbb{E}[A_{k-1,k}] = 1\cdot p+(1-p)\mathbb{E}[X_{k}+1]$$ substituting and simplfying yields
$$\mathbb{E}[X_k]=\frac1p+\frac{\mathbb{E}[X_{k-1}]}p.$$ Using the fact that $\mathbb{E}[X_1] = 1/p$, we have that the expectation of $k$ successes is $$\mathbb{E}[X_k]=\frac1p+\frac1{p^2}+\cdots+\frac1{p^k}.$$
Now, going back to our problem we have
$$\mathbb{E}[N_B\vert H_A=n]=\sum_{i=1}^n2^i=2^{n+1}-2.$$ So $$\mathbb{E}[N_B]=\sum_{n=1}^\infty\left(2^{n+1}-2\right)\left(\frac12\right)^{n+1}=\infty.$$
Edit 2:
I wrote a really basic simulation of the exercise in python to test the result above. It indeed seems to diverge.