How to use ssh-copy-id with multiple-hop ssh tunnel?

You can pass any ssh option to ssh-copy-id with the -o option. By using the ProxyJump option you can use ssh-copy-id to copy your key to a host via jump host.

Here's an example where I copy my ssh key to leia.spack.org via the jump host jump.spack.org:

$ ssh-copy-id -o ProxyJump=jump.spack.org leia.spack.org
[email protected]'s password:

Number of key(s) added:        1

And then test it with:

$ ssh -J jump.spack.org leia.spack.org
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-42-generic x86_64)

I don't think it is possible with ssh-copy-id to do a double hop. You can use scp to jump the file through one server to the third. look at man scp. but then you would still need to do some work to get the text into authorized_keys and set perms

However!

You can use ssh to jump through a server to another server then issue commands there.

Something like this would copy keys from here to there. you will have to copy the .ssh/id_rsa.pub key you wish to send and paste in place of mysupersecretkeyfromhell below and obviously change the names and ip addresses.
Something similar to this will jump through the first server, ssh into the 2nd and run your commands.

ssh -J [email protected] [email protected] echo mySupersecretKeyfromehell >> .ssh/authorized_keys && chmod 700 .ssh && chmod 600 .ssh/authorized_keys

This assumes your running a recent version of ssh.

You could also shorten the last command by putting your key in a variable.
Note back ticks below not single quotes!

MYKEYVAR="echo `cat .ssh/id_rsa.pub`" 
ssh -J [email protected] [email protected] echo $MYKEYVAR >> .ssh/authorized_keys && chmod 700 .ssh && chmod 600 .ssh/authorized_keys