The general election is subject to the Constitution. Primaries are not and political parties make their own rules. Puerto Ricans are U.S. Citizens and at some point the parties decided to give these citizens a measure of voice in the selection process.
Ah! This is about delegates to the convention. Gotcha.