Problem with optimal policy searching

No, there is also monopolistic competition. Both together lead to deviations of output from efficient output and to price dispersion. Each shock in the model leads to different movements in these two gaps. The reaction to inflation and output simply reflect how to best address those.
Note that this is complicated by the fact that the Taylor rule describes off-equilibrium behavior as mentioned in