But some of the restrictions may be on how the constitution was worded. "A well regulated Militia, being necessary to the security of a free State," implies that that person has an interest in the United States, instead of being a visitor. So only nonimmigrant visa aliens have a hard time, but there are exceptions.
Even so, law that exists does not imply that it is correct or just with other laws. The AI tool in the article or some of the restrictions are up for debate on their legality. The same way why people debate gun restrictions on their constitutionality.