You do not give the precise definitions of $\gamma f\bar\gamma$ and $f\bar\gamma\gamma$ as maps with domain $S^1$. It cannot be the usual concatenation of paths.
However, as you write, we can use the standard quotient map $\exp : I \to S^1, p(t) = e^{2\pi it}$, to obtain a bijection between the set $\mathcal C(S^1, X)$ of continuous maps $f : S^1 \to X$ and the set $\mathcal L (I,X)$ of loops in $X$ (i.e. paths $u : I \to X$ with $u(0) = u(1)$):
$$\exp_* : \mathcal C(S^1, X) \to \mathcal L (I,X), p_*(u) = u \circ p .$$
In $\mathcal L (I,X)$ we define loops $u,v$ to be loop homotopic, $u \simeq_l v$, if there is a homotopy $h : u \simeq v$ such that all $h(-,t)$ are loops. Let $[I,X]_l$ denote the set of loop homotopy classes.
Note that loop homotopy in $\mathcal L (I,X)$ is a coarser relation than path homotopy in $\mathcal L (I,X)$ (recall that a path homotopy $h : u \simeq_p v$ is required to be stationary on $\partial I = \{0,1\}$). Clearly $u \simeq_p v$ implies $u \simeq_l v$.
Also see Characterizing simply connected spaces for these concepts.
It is easy to see that $\exp_*$ is compatible with homotopy, i.e. induces a bijection
$$\widehat \exp_* : [S^1,X] \to [I,X]_l.$$
Given $f : S^1 \to X$, write $\hat f = \exp_*(f) = f \circ \exp : I \to X$. Then the path concatenations $\gamma \hat f\bar\gamma$ and $\hat f\bar\gamma\gamma$ can be defined. Note, however, that concatenation of paths is not associative. The paths $(\gamma \hat f)\bar\gamma$ and $\gamma (\hat f\bar\gamma)$ are not equal, but only path homotopic.
We can interpret $\gamma \hat f\bar\gamma$ either as $(\gamma \hat f)\bar\gamma$ or as $\gamma (\hat f\bar\gamma)$ , but it is irrelevant because we are only interested in path homotopy classes. In other words, what we really consider is the loop homotopy class
$[\gamma][\hat f][\bar \gamma] = [\gamma \hat f\bar\gamma]$ which is well-defined. Referring to Proving Munkres Theorem 51.3 we see that $[\gamma][\hat f][\bar \gamma]$ is represented by
$$\hat f_1 (s) = \begin{cases}
\gamma(3s) & s \in [0,1/3]\\
\hat{f}(3s - 1) & s \in [1/3,2/3]\\
\bar{\gamma}(3s - 2) & s \in [2/3,1]
\end{cases}$$
and $[\hat f][\bar \gamma][\gamma]$ by
$$\hat f_2 (s) = \begin{cases}
\hat f(3s) & s \in [0,1/3]\\
\bar{\gamma}(3s - 1) & s \in [1/3,2/3]\\
\gamma(3s - 2) & s \in [2/3,1]
\end{cases}$$
Both are loops and thus descend to maps $f_i = (\exp_*)^{-1}(\hat f_i) : S^1 \to X$. The homotopy classes $[f_1]$ and $[f_2]$ only depend on the loop homotopy classes of $\hat f_1$ and $\hat f_2$.
We want to show that $f_1 \simeq f_2$. Such a homotopy can easily be obtained via the rotation
$$r : S^1 \to S^1, r(z) = e^{2\pi i/3}z .$$
Clearly $r$ is homotopic to $id : S^1 \to S^1$. Thus $f_1 \circ r$ is homotopic to $f_1$. It is an easy exercise to verify that $f_1 \circ r = f_2$. Just consider the map $g = \exp_*(f_1 \circ r) = f_1 \circ r \circ \exp$ and check that $g = \hat f_2$.