The fault is not with UA here. The fault is primarily with you since pax names that were not 100% consistent with the government ID.
Now, minor typos or even first/last name switched is generally not an issue. UA and most other airlines allow travel no problem and they did. The question therefore becomes, did TG rightfully deny boarding or do you have a case against TG. This IMO is the only angle you can pursue here. I would check on TG's policies with name misspelling in the TG forum.
Expensive lesson for sure