Your first pipe
The | (pipe) takes everything the command on its left prints and feeds it to the command on its right as input. Neither command knows the other exists.
The second line asks how many deposits were there? grep answers "which lines?", wc -l answers "how many?", and the pipe composes them into a question neither tool can answer alone.
Real world: ps aux | grep python | wc -l counts how many Python processes are running. Same shape, different data.