hardtail XC bike
This might be part of your answer. Modern mountain bikes aren't nearly as good on the road as vintage ones were.
However, don't replace your bike before you check your technique. Did you get a professional fit when you got your bike? If not, did you talk with anyone experienced about setting up a bike for a comfortable riding position? Bikes do NOT come out of the box or out of the aisle set up well for most people, and it's not always intuitive what the best position for you might be without experience.
Average speed is going to be highest when you can maintain pace. Straight, flat paths with few stops. Are you able to find a stretch of, say, 2 miles that has few to no deviations or stops? Including curves - if you have to slow down and then accelerate again, that's inefficient and will tire you out.
How's your tire pressure? Rolling resistance is greatly affected by tire pressure.
Gears? Are you able to pedal at your most comfortable speed of pedal rotation at a maintainable pace?
I'm by no means a pro - I'm also old and overweight, but 10 mph average over a long ride comes very easily when I compensate for those factors.
Every Republican.