$$\begin{array}{l|rcl}
f : & M_n(\mathbb R) & \longrightarrow & \mathbb R\\
& X & \longmapsto & a^T X a \end{array}$$
is a linear map.
Critical is to understand what the domain and codomain of $f$ are in order to understand what $f$ is as a function.
Hence its Fréchet derivative at each point is equal to itself: $f^\prime(X).u =a^T u a$.
Following a detailed and interesting discussion with Jean-Claude Arbaut (see the comments!), we can rewrite
$$f^\prime(X).u =a^T u a = \mathrm{tr}(a^T u a) = \mathrm{tr}(u \cdot (a \cdot a^T))= \mathrm{tr}((a \cdot a^T) \cdot u) = \mathrm{tr}(A \cdot u)$$
where $A = a \cdot a^T$ is defined as the matrix calculus derivative of $f$ with respect to $X$. This is in fact what is meant by
$$\nabla_{\mathbf{X}} \left( \mathbf{a}^{T} \mathbf{X} \mathbf{a} \right) = \frac{\partial\left( \mathbf{a}^{T} \mathbf{X} \mathbf{a} \right)}{\partial \mathbf{X}}=\mathbf{a}\cdot\mathbf{a}^{T}$$ in the Matrix Cookbook.