Hi Spectre, welcome.
With any sci-fi you can get that won't work, but my philosophy is, well if we knew how such cool ideas could be made to work we would all be rich and it wouldn't be fiction after all.
IMHO the biggest "problem" with mecha is internal consistency with how most settings are defined. For them to be viable machines of war they would have to have some advantage over non-walker units at least in some tactical situations. Given that many classical mecha are huge, I would postulate they have some serious advantage on the battle field (relative to other vehicles) that would make them viable.
Here's my ideas to fit them into YTU. Give contra-grav/anti-grav designs a major disadvantage, three are: cost, vulnerability and signature.
cost
If grav units cost a fortune they will still be part of armies but to a lesser extent and used where needed. Cost usually does not deter PCs after a point so this is one way for them to be available to PCs but not prevalent in armie or at large. Cost can also include ease of repair and amount of maintenance, instead of sheer up front cost. The logistical load of something that breaks down all the time is not good for a large army on a budget. High maintainance costs if the vehicle is pushed might also make grav vehicles viable for civilian use but disfavored as the core military heavy weapons platform.
vulnerability
On vulnerability, if grav vehicles are easy to knock out they will be disfavored by the military or used more judiciously; but may still find wide application in civilian use.
signature
My favorite. In your Traveller universe (YTU) you may speculate that contra-grav and anti-grav vehicles emit gravitons (or what have you) that gives them a huge "electronic-type" signature on the future equivalent of radar. More improtantly, these emissions might be detectable over-the-horizon. Mech being powered by good old fashioned legs emit no such signature and can take advantage of all the higher tech to mask their other emissions. They are detectable only by line-of-sight.
If I used mecha, I imagine that they sneak around and are heavily camouflage. They make use of there legs to travel in a squat low to the ground, but can quickly pop up to fire or scan for targets. Even if the grav vehicle signature is not so huge, mecha might find a use as heavy forward scouting vehicles, a fine role for a PC to fill.
legs vs. treads
In a far flung interstellar empire, walker vs. tracked vehicles might be more of a standard ground combat unit as legs can usually navigate more broken terrain than tracks. In addition, the structure of the feet might be such they can grapple onto ship hulls, giving mecha a nother potential use not found in wheeled or tracked vehicles. To address ground pressure issues give the mecha big feet, and maybe they crawl if it is really muddy.
humano-form
If you postulate some form of integrated neural control (e.g. tapped into the nerves of the arms and legs), or even just amplified human motion, human-form mecha make some sense as the control system relies on the built in human experience with using arms, legs and balancing a bi-pedal being. In fact to take advantage of this with minimal computer processing, the mecha could be built with the center of gravity of a human. And since the center of gravity of men and women differ, maybe there is a role women pilots can serve best. In a sense, if the proper nerves could be tapped and the signals amplified, the control system might be highly analog and thus potentially much more reliable/tougher than the complex computer processing that might be needed to maintain a contra-grav field.
Just some suggestions to address the internal consistency problems and the why of walkers vs tracks vs wheels vs contra-grav.