Usually 15 km in hour is considered good speed for XC. I did a race last year and averaged 15.2 in a 30km race and came second. Mind you it was an amateur race not a pro and it was a mix of double and singetrack with mostly singeltrack.
Very difficult question to answer as it completely depends on the trail. While elevation change is certainly a factor, other factors can have a much greater impact on average speed such as terrain (i.e. is it flat hard pack or is it rocky, rooted, sandy, stream crossings, etc) as well as contour (flowy vs twisty, narrow/tight vs open). On a flowy, hardpack trail a good average speed is probably 10+mph. On a tight, technical, rocky trail with lots of corners 5-6mph could be a good speed. Best way to know for any given trail is to compare to Strava times.
Average speed on a mountain bike is meaningless. We have several trails near us all of which are intermediate level. I average about 7mph on one because it’s tight and twisty and am in the top 5 on Strava but 12 mph on another one that is flowy but am outside the top 10. What matters is lap time relative to others on the same trail, not average speed.