I used to do all of this type of stuff to get my copy-paste to work in tmux but honestly it's still a pita. The alternative I started using recently (zellij[1]) has copy and paste, scrollback, dump scrollback to editor etc just working out of the box with no fancy configuration required and also has a much saner session management mechanic that also works right out of the box.
[1] https://zellij.dev/