The CB antenna will never be good on an Xterra, to much metal junk on the roof going everywhere. HF is a tricky finicky type of RF and roof racks create the worst environment. That tray is nowhere near large enough to be a proper ground plane for HF, maybe if you had a van roof with nothing at all on it, you might get close. Remember there are two kinds of ground, RF ground plane, and electrical ground. With the layers of metal over metal, this is creating a wild crazy environment for the radio waves to launch from, so even though it's flat, it's still not simple. What makes it even worse, is those racks are insulated from the roof, so it's not bonded at all and RF won't know where to go, and you may only have one electrical ground. It's kind like trying to take off in a plane from a Wal-Mart parking lot.
A mag mount in that tray might be acceptable since it is up a little higher. Height is probably the best reason for a CB antenna there. CB is short range anyway, as long as it's working for casual on the trail comms, I wouldn't spend a lot of effort attempting to optimize it's performance. By all means tune it and do the best you can, but I'm saying if it serves it's purpose and the SWR is acceptable, perhaps that is good enough.
2M isn't picky, it will do pretty well anywhere, I have a 5/8 wave same spot as you on a bracket coming out the hood/ fender gap. Gets out fine, maybe a bit directional but so far quite good. A 2M antenna on top that tray should do fine.
Speaking from personal experience, YMMV, but once you start trying to use the roof for anything, then you realize those antennas are in the way. This is just my humble opinion, but you have a decent setup as is. Both your antennas are out of the way, leaving the roof wide open for whatever. Having my CB antenna on the roof rack for quite a while, it was a constant problem, I try to load a kayak, it's in the way. I need to go in the garage, it's in the way. Go to the drive thru, ker-thump, ker-thump, ker-thump, it's in the way. (They don't give so well when the spring is at roof height....) I got a RTT, it's in the way.
It might seem with the tray you don't intend to put anything large up there, but before you know it, someone will be like, "can you move this for me?" And whatever big item you find fits on the rack, and sticks square over where your antennas are. Or you might change your mind and start wanting to load other things up there. If your darn sure you won't, well then it's a fine place for antennas.
It's all in what you want to do, but far as I'm aware in my limited knowledge of antennas, and I'm still learning, I wouldn't be in a rush to put antennas up there just because it's new mounting territory.