@Ash *********
There isn't one global system that tracks this, it's country by country. Governments know about people who enter that country only. Outside a few specific data sharing arrangements, which aren't typically "live", they don't know about third party travel.
Within Schengen (or the CTA between the UK and Ireland) there aren't borders so they don't even necessarily know about travel into their own country in that case.
Thailand certainly won't know if a person travels from Spain to France. This is why they ask for things like tickets, photo with a landmark, or call people for interview.