Even if Rahimi had agreed with the state that he wouldn't contact his girlfriend or possess weapons, that doesn't get to whether the federal government can effectively erase one of his basic rights over such an agreement.
I'm not sure the principle you are espousing actually holds. There is a LONG history of "effectively erasing basic rights" during military service. You sign a contract with the govt, agreeing to that. Draftees (which no longer exist) might have an argument about being compelled, but volunteers do not. One literally, signs away numerous fundamental civil rights for the duration of your service. Particularly ALL your rights under the civilian justice system. You have specific rights under the UCMJ, but they are NOT the same as those of the civil system.
If you and Metal god signed an agreement to never vote, and become indentured servants, we'd still have all sorts of constitutional problems with it.
If Metal God and I enter into any agreement, we do so as private citizens, so it is not a case of govt vs citizen and no claim of govt violating any rights due to an agreement between private parties would be valid.
IF the agreement stipulated violation of existing law, that would be a matter for govt to be involved it, in its role of enforcing law. And that would be entirely dependent on the specific details of the private agreement. IF the agreement is of such a nature that it could constitute conspiracy to commit a crime, then the govt would have grounds for prosecution under the conspiracy laws. Whether or not it would be successful depends on the specifics of the case.
Here's a point to consider, about "agreeing" to a restraining order, the person who accepts the order, agrees to abide by its requirements. They may feel they have no other choice, they may SAY there was no other choice, but there is ALWAYS another choice.
It is actually simple, but the other choice is to refuse to accept the order and require the govt to go through the entire due process procedure. Arrest, prosecution, trial by jury, etc.
If you lose, the result is often much less desirable (such as conviction and jail time) than accepting the restraining order with all its restrictions, but that is not the same as having NO other choice.