The bug
The @s
selector is described in command blocks like this:
Use "@s" to target a player in /execute
This is not completely correct since the selector works for any entity and can be used in other situations as well. As described in MC-116808 the following describes the selector probably better:
Use "@s" to target the executing entity
Fixed according to suggestion