There are international treaties about handling prisoners of war. The thing is that US found a loophole not to admit that they are prisoners of war. What US did is similar to what their enemies like Taliban do.
The US didn't "find a loophole." Prisoner of war protections under international treaties only apply to state participants, meaning members of a state army.
Terrorists and other non-sanctioned armed forces are not protected by treaties between states because they are not fighting on behalf of a state. This is a recognized and intended exception to the rules governing POWs.
But let's focus on the lack of process in taking them captive instead of just killing then.