Describing the asymtotic complexity of processing two-dimensional data structures
The solution is that you shouldn't just ask whether it is "linear" -- ask what variable it is "linear" in.

Your example code has running time that is linear in the total length of the input strings.  There's a long history of characterizing the running time of an algorithm as a function of the length of the input to the algorithm, and that's an entirely valid thing to do.

It's also true that its running time is $O(nk)$ where $n$ is the number of strings and $k$ is the length of the longest string.  This might be a looser bound.

Both statements are true, and don't contradict each other.  It's just a matter of identifying which upper bound on the running time is more useful.