Yes, riders should wear something under their denim fabric. Compression leggings or shorts can be worn under denim fabric or any cotton fibre clothes. They wick away sweat in Summer to keep riders cool and dry and retain heat during chilly Winter rides.
If you're buying your very first pair of riding pants then this will be a low priority, but something to be considered somewhere down the road.