Great question — answering as the UphillTech team:
In the second and third commands, wc -l reads content from the standard input and counts the number of lines it received. It has no knowledge that the standard input had the content of f2 written to it. Since there's no file here, you just get the number of lines, without the file name.
Full answer by Mureinik: https://superuser.stackexchange.com/a/1940750 (CC BY-SA 4.0).
Need it done for your business? UphillTech.