Yes, the tower can tell an aircraft to abort take off and instruct it to return to the gate, although it probably never got that far in this case, I'm guessing that they got to the runway or were asked to line up when the request came in. This was probably at the direction of Ryanair, since the tower would otherwise not have any information on the wrong cargo being loaded, nor would it really care.
I'm guessing at this part....
The back-and-forth probably went like this:
Tower: Ryanair 1234 line up and wait
Ryanair: Line up and wait, Ryanair 1234
Tower: Ryanair 1234 taxi on runway to Delta, call company
Ryanair: Taxi delta, call company
The tower probably didn't relate too much information about what is wrong, the pilots have the ability to talk to the dispatcher for Ryanair to get more information.
Regardless, a tower controller can tell an aircraft that a take-off clearance is rejected, even after the take-off run begins. It is up to the pilot to determine if they can safely reject the take-off and to follow those instructions.
The probability though that the tower knew that the incorrect cargo was loaded is probably zero, at least until somebody from Ryanair called them and had them stop the take off. I'm guessing that they didn't actually get take-off clearance (line up and wait is not take-off clearance) and either they were asked to line up, or they were waiting to enter the runway before they were told to go back (and taxiing on the runway is the easiest way to turn around).
Typically Tower will not call a RTO unless there is a safety concern like an incursion or they notice a wing fell off. Once clearance is given it is rarely rejected. If they had gotten clearance Tower would probably have advised them to call company "once in the air" rather than reject a take off.
If you want to know what it sounds like for Tower to reject a take-off, listen to this YouTube about a near miss regarding similar call signs and two aircraft taking off at the same time.