Note: This answer used to be a counterexample that missed the mark.
The way to get around he definitional issues with conditional expectations is to work with regular conditional probabilities in product form, which guarantee that all conditional expectations fit together well. In particular, there exists a measurable function (or a transition probability, essentially the same thing) $\kappa:A\to X$ such that for $\pi_A$ the $A$-marginal of $\pi$, we have for every Borel set $E\subseteq X\times A$ that $$\pi(E)=\int\int 1_E(x,a)~\mathrm d\kappa_a(x)~\mathrm d\pi_A(a).$$ The function $\kappa$ is unique up to $\pi_A$-null sets.
That way, one can show that $$\max_{f\in \mathcal{F}}\int_{X\times A} u\big(x,f(a)\big)~\mathrm d\pi(x,a) =\max_{f\in \mathcal{F}}\int_A \int_X u\big(x,f(a)\big)~\mathrm d\kappa_a(x) ~\mathrm d\pi_A(a)$$ $$= \int_A \max_{f\in \mathcal{F}} \int_X u\big(x,f(a)\big)~\mathrm d\kappa_a(x) ~\mathrm d\pi_A(a).$$ The left side is trivially no larger than the right side. For the other direction, you show that the correspondence that associates to each $a$ the argmax of $\int_X u\big(x,\cdot\big)~\mathrm d\kappa_a(x)$ is measurable with nonempty compact values. So you can use the Kuratowski-Ryll-Nardzewski measurable selection theorem to turn a solution for the problem on the right to a solution of the problem on the left, which must, therefore, give the same value.
The argument does not require $X$ to be compact, any Polish space will do, and $u$ need not be continuous in $X$, any bounded (or integrably bounded) Carathéodory function will do.