Ok, we can avoid this by extracting the scaling and the FFT operator by ourself:
f3(x) = real(norm(pifft.scale .* (pifft.p * fftshift(pfft*x))));
julia> include("/tmp/discourse.jl")
f(x0) = 100.96395788714146
f2(x0) = 100.96395788714146
f3(x0) = 100.96395788714146
0.000428 seconds (43 allocations: 1.375 MiB)
0.000589 seconds (175 allocations: 1.232 MiB)
0.000525 seconds (84 allocations: 1.835 MiB)
gx[1] ≈ gx3[1] = true