Wikipedia is actually the secondary source when someone reads a page on it, and it requires primary sources (like factbooks) to cite to exist.
The problem is who checks the sources. Of the what billions of sources, how many have actually been verified?
Encyclopedias are by definition tertiary sources.
This is incorrect. Wikipedia relies primarily on secondary sources, which makes it a tertiary source, and it describes itself this way.[1] The World Factbook does not collect the information it provides, making it a secondary source.
[1]: https://en.wikipedia.org/wiki/WP:PSTS