I didn’t explain myself very well I have no issue whatsoever with
void mousePressed() {
   nodes.add(new Node(mouseX,mouseY));
}
because you are not actually reading mouse input inside the ctor, you are simply passing mouse data as parameters.
I would have a serious issue with
  void mousePressed() {
     nodes.add(new Node());
  }
  
// And inside the class
public Node(){
    this.x = mouseX;
    this.y = mouseY;
  }