Didn't see a sarcasm tag so I'd like to ask ... where would you prefer docking them instead?
Gee, I don't know....where did we dock them for the 60 years that we've been controlling the Strait of Hormuz before the Port of Dubai? Dubai is a well paid convenience, nothing more.
Ok good question with a reasonable answer and explanation. Anchor them 2 miles off shore except for U.S.N.S. supply ships. Why? Because of security concerns. In 4 years of Navy time and three major deployments the carrier I was on docked only once pier side in a foreign port and that was late 1970's France with a different political climate than today. Anchor them and run liberty boat launches. Reason? This greatly limits persons access to the ship and gives much more time to respond to an attack. As well it leaves the ship capable of leaving port within minutes on it's own power. It's just plain common sense protocols that served us well for decades.