I can't leave a comment at the time of writing this (since I don't have enough reputation right now), so I'll leave this as an answer.
Your question is a bit confusing. It's titled "How to get taxonomic data", but at the end of the post, you mention "Basically, from this, you can construct the full taxonomic tree. When looking at the pubmed taxonomy data I don't see how to reconstruct the tree. Please show me how."
I'll try to address both your questions here.
**Acquiring the lineage data:**
Are you perhaps looking for something like this?
NCBI taxonomy itself is also accessible programmatically via E-Utilities.
**Constructing an evolutionary tree:**
You could perhaps use something like the `data.tree` R package to construct your tree using the lineage data.
Your question is a bit too vague, so I apologize if my answer is of no assistance here.