Self-assembly and elastic instability in polymer flows