Many/most systems of natural deduction for classical (non-relevantist) logic allow (i) reiteration, and also (ii) unrestricted discharge of assumptions -- so we are allowed to write
- $p\quad\quad\quad$ Premiss
- $\quad|\quad q\quad$ Supposition
- $\quad|\quad p\quad$ From (1), by reiteration
- $q \to p\quad\ $ Conditional Proof, by proof from (2) to (3)
There is indeed no 'link' between $p$ and $q$ at step (3). But that isn't needed at step (4), in most systems. The CP rule is: given a sub-proof starting from $A$ and concluding $B$ we can discharge the assumption $A$ and infer $A \to B$ (on the remaining assumptions/premisses). We don't, in typical classical systems, have to check that the assumption $A$ is actually invoked in getting to $B$.
Does that mean we shouldn't like reiteration and/or should restrict discharge? Well, actually that wouldn't much affect things in the presence of other standard rules. Thus consider the proof
- $p\quad\quad\quad\quad$ Premiss
- $\quad|\quad q\quad\quad$ Supposition
- $\quad|\quad p \land q\quad$ From (1), (2)
- $\quad|\quad p\quad\quad$ From (3)
- $q \to p\quad\quad\ $ Conditional Proof, by proof from (2) to (4)
And now $q$ is invoked en route to getting to line (4).