Playing with a faction with knowledge and civic perks you are not able to build the market after researching the trading tech. I have not verified this with standard factions but it was repeated with two different custom faction with the same perks. This is for all cities. I verified that the city has space to build an new improvement and that is also has the merchant already built.