Because this is immigration and there is no right to be in another country. I've been detained for irregularities in other countries while just doing tourism. This is a normal and expected part of travelling to foreign countries.
With immigration, the issue that needs fixing is your presence in a country.
Look, I respect people who actually believe in free movement globally but most people claiming there's something wrong here don't believe in open borders.