I didn't say you needed to be a US resident to register a company.
I said that most pre-GC work-permits (e.g. H1B) don't allow you to own a US-based business. If you're here on a work-permit, they (the govt.) expect you to be an employee of your sponsor, they don't want you to start a business.
To your point,
one can be an investor in a US company without having a US visa/residence/work-permit. Although, to open a business without living in the US, only a handful of states allow this (e.g., Delaware, Wyoming, Nevada).
However, once again, if you are in the US on a work-permit, you need to follow the rules of the work-permit. The rules applicable to non-citizens who are not living in the US on a work-permit may be different.