That will still discourage foreign trade with China. Not all shipping companies will be using Chinese-made ships. Because of port fees, the ones using Japanese and Korean ships may find it cheaper to trade with India and Vietnam than to trade with China.
Retaliatory port fees in the US and in China will discourage foreign trade in both countries. That will benefit all other countries who do not charge draconian fees at their ports.
If you look at port container traffic in 2022, you get the following figures
China+HK: 247 Million TEU
SE Asia + East Asia (exc CN/HK): 141 Million TEU
US: 38 Million TEU
Other: 118 Million TEU
So you can see China and HK is almost half of all container traffic in the world
---
Remember that container ships typically call at a large number of ports.
And typically sea freight costs make up a small fraction of the overall cost.
So my gut tells me that if China starts imposing steadily rising port fees on ships not built in China, the demand for Chinese exports will still remain, and it works out better to buy more Chinese ships to ensure you don't get charged those port fees.
Alternatively, instead of charging fees for foreign-built ships, they could offer discounts to Chinese-built ships. You get the same effect.
But is there any point?
The latest data indicates that China obtained 75% of all ship orders this year.
Plus the US only accounts for 7% of global container trade.
So whatever tariffs the US does implement won't change the big picture