If you gave the defender time to get defense up then you were not attacking. If you had the SAME mass invested in tanks as the opponent invested in the engineers+tanks AT THE SAME TIME, then you would win, because your tanks would kill the engineers before they built the PD. Travel time does not matter because the opponent's engies had to travel to where they were building the PD, just as your additional tanks (mass for mass cost against your opponent's engies) had to travel there, too.
If they build the PD back at their base then you would win map control (because you have more tanks outside their base, so you win that area) and have more mexes, so you'd get more mass, so you'd win (assuming again you aren't "stupid" with that mass, yes I know you're just dying to say "but what if you use that mass to spam AA when they don't have any air"). MAYBE there is an exception if mexes are not distributed around the map like on Astro maps, but even then you wouldn't attack until you knew you could win, so you'd eco, so them building a PD means they weren't putting as much into eco as you, so defending essentially lost them the game.
The same principal applies to T2 ACU vs. gun ACU. T2 ACU is cheaper so it finishes faster, but then you still have to build PD. ALL ELSE EQUAL, not giving your opponent time to build, gun ACU will always win because you will kill the PD before there are so many you become overwhelmed. I've won many games this way, going gun vs. someone going t2. Problem is all else is not always equal—if you are too far away and give them time to get PD up, it doesn't work. Or if they have more eco than you and get upgrade faster. Or... or... all sorts of ways it could not be equal.
I think we all have better stuff to do than indefinitely argue nuance and exception. It's like I'm saying "stoplights work" and you're saying "but this one time this guy turned right on red..." yes, there have been millions of traffic accidents where people didn't drive ideally and stoplights "didn't work." But billions, possibly trillions of times a day, a car goes through an intersection without crashing (think about how many cars go through how many intersections each day). Just because people make wrong decisions doesn't mean stoplights don't work, and I am not going to point out every mistake every driver ever made that wasn't the fault of the system.
I will just wonder aloud though, why if defending wins, you see far fewer firebases etc. in higher-ranked games than in lower-ranked games. Not no defenses whatsoever, because sometimes all else is not equal, but as a general theme in higher-ranked games it seems like they prefer units than can move over static defenses.
See you in-game.