If you are trying to implement torque control, you only need a control loop around torque. The challenge isn't in trying to integrate the torque (or acceleration) controller, and passing it to a velocity control loop, then finally passing it to a position control loop. The challenge is in finding the torque setpoints for your torque control loop so that the manipulator achieves the desired performance. For this you need a model of your robot + environment if you want to use torque control to follow position profiles. That model will be where you incorporate $s^2$ differentiation to get to desired accelerations.
But I have to ask - why are you implementing torque control to achieve positional stability? This gets very complicated if the impedance of your robot's environment changes. For example, of the system is lifting a box, controlling the torque can result in the desired positional profile. But what if the robot encounters an immovable object - then you will never get the commanded positional changes. Or, what if you have multiple heavy and light boxes? The position-to-torque model must account for these things.
See @MarkBooth's answer to this SE question about position, velocity, and torque control.