I'm reading a book where it says in 1664 the British had 4000 high seas ships and the Dutch had 16000 (!), whereas France only had 400. There are a lot of forests in France, some of which were planted just for that, but I know there wasn't much in England or Netherlands. Did they build ships with timber from the colonies ? Is it possible as early ? Thank you for your answers.
The relatively short answer to this is that Britain at least (I can't speak to the Dutch) used to be much more forested than it is, and that it was deforested in part because of the need to build a large fleet for defense.
But Britain (and other maritime nations) did in fact also source materials from overseas, and did build ships in its colonies. In regard to sourcing materials from overseas, Scandinavia was rich in naval stores, particularly pitch/pine tar, poldavy (a type of canvas) and of course pine trees for masts and spars. Lumber was also sourced from America, including both pines and live oak trees which were used for the keels, knees and structural components of ships. (The modern US Navy still maintains a live oak preserve in Florida, partly to ensure a supply of timber for USS Constitution.)
Regarding shipbuilding in the colonies, here's some info adapted from this older answer of mine:
I'm assuming you're talking about ships built roughly during the period 1750-1850, so I'll answer based on that. Yes, Britain did build ships in its colonies, particularly in the Caribbean and the Americas but also in India. Most ships that were built overseas were sloops, brigs and other small ships (because most ships the Navy built were small), but some yards could build ships-of-the-line.
The British dockyards in Bombay were extensive. Jamsetjee Bomanjee Wadia was the master builder there from 1792-1821. In the portrait linked above, he is holding plans for the Minden, a 74-gun ship-of-the-line built there in 1810. His frigate Trincomalee, built there in 1817, is still afloat and is a museum ship. Minden and Trincomalee were both built of teak, as were other ships built in Bombay, at least partly due to wood shortages (oak in particular) in Britain. Teak is difficult to work, but once part of a ship is nearly indestructible under normal wear and tear (it could be damaged by gunfire/accident/etc. but weathers well).
A descendant of the Wadia family (the Bombay dockyard family) wrote a book about the yards, which I once found through ILL.
Perhaps the most famous development of British overseas shipbuilding was the Bermuda sloop. The Bermuda sloop was called that because of its origins in the island and its fore-and-aft sailing rig with triangular sails and raked masts. The Bermuda rig could be fitted onto vessels with a largely varying number of masts (the term "sloop" is confusing in this context, as a sloop is usually a single-masted vessel) and worked well when sailing into the wind. Ships were also built in the American colonies, but those sources of naval procurement were cut off (obviously) after American independence. It's worth mentioning that the original six frigates of the U.S. navy were produced in six different ports (though with varying success).
The Spanish navy established a large shipyard at Havana in the early 1700s, which was building nearly a third of all its ships by the 1750s. (Ships had been built in the Caribbean before then, of course.) The Havana yard built ships of tropical hardwoods; the Nuestra Señora de la Santísima Trinidad was probably the most famous. Santísima Trinidad was originally built to carry 112 guns, but her forecastle and quarterdeck were later joined to produce a fourth gun deck and she carried up to 140 guns, making her the largest ship-of-the-line during the Napoleonic wars. She was captured at Trafalgar and wrecked in the storm that followed the battle.
I am not aware of the French navy building ships overseas, but perhaps someone else can add to the conversation.
In terms of "having to sail around the world," yes, ships would have to do that and do it fairly often. Even British shipyards were dependent on naval stores from the Baltic (cordage, tar, pitch, etc.) that would be combined with masts from Russia or the Americas, oak from native forests, etc. The production of ships and the materials from which they were sourced was a global process in this period.
If you want to know more specifics about ship design and construction in this period: https://www.reddit.com/r/AskHistorians/comments/44sivx/ship_design_and_construction_in_the_age_of_sail/