Is it possible to use an electrical motor with a constant torque while simultaneously turning against it?
All the things you are talking about can be done with motors provided that the motor is controlled intelligently. Some types of control may require shaft position sensors on the motor.
Motors can be controlled to apply constant torque, or constant speed, or to hold a specific position (constant position) or various combinations of these things. For example you can tell a motor to hold a specific position but with a low programmed torque limit. Then if you move it away from that position in either direction it will resist you but with gentle force. If you move the motor then let go, the motor will return to the set position.
AC induction motors, brushed DC motors, and brushless DC motors all can be controlled in this fashion. There are tradeoffs between the different types. Often BLDC is the highest performance and highest efficiency.
One comment about torque because I think you have a wrong idea about what fixed torque means. The motor applies torque to the drive shaft. The load also applies torque. In a typical machine, the two torques are equal and opposite meaning the net torque is zero. Now this next statement is very important: If the motor torque and load torque are not exactly equal and opposite, the motor will either be speeding up or slowing down. If you instruct a motor controller to make maximum torque with no load, the motor will spin up to speed very rapidly. So you shouldn't have the idea that you can command a motor to output a torque and you can then push against it. You can command the motor controller to hold a position and push against it. But pure torque output will usually lead to runaway speed if you remove the load on the motor.