The total number of rolls follows a geometric law of parameter $p=\dfrac{4}{6}=\dfrac{2}{3}$. Therefore the expected number of rolls is $1/p=\color{red}{1.5}$.
Therefore the expected total is $(1/p-1)\cdot 1.5 + 4.5=\color{red}{5.25}$, because $1.5$ is the mean of a roll between $1$ and $2$ (and you have an average of $1/p -1$ rolls between $1$ and $2$) and $4.5$ is the mean of the last roll (between $3$ and $6$).
By the way you can easily verify your results for this kind of problem with a simple python code:
import random as random
nb_trials = 10000
tot = 0
for i in range(nb_trials):
sum_value = 0
b = True
while b:
a = random.randint(1,6)
if a >=3:
b = False
sum_value += a
tot += sum_value
average = tot * 1.0 / nb_trials
print(average)
Try it online!