Paths might be interesting but loops are far more interesting. That's because the multiplication on homotopy classes (induced by path composition) in case of paths is only associative but it generates a group structure in case of loops. So if we restrict to loops then there's a neat way to generalize the concept. First of all note that there's an equivalence between loops $I\to X$ and maps $S^1\to X$.
One of the fundamental properties of $S^1$ that is used is that it behaves well under wedge sums (as in gluing two spaces at given points).
Generally, let $X$ be a topological space, $x_0\in X$ a fixed point and
$\psi: X\to X\vee X$
a map such that right side is glued in $x_0$ (in both sides) and $\psi(x_0)=x_0$ (which is unique in $X\vee X$).
Now let $Y$ be another topological space with a fixed point $y_0\in Y$. Consider $f, g:X\to Y$ continous such that $f(x_0)=g(x_0)=y_0$, then we can define
$f\cdot g : X\to Y$ $f\cdot g = (f\vee g)\circ\psi$
And the new map again maps $x_0$ to $y_0$. You may think of $(\cdot)$ operator as a generalized path composition.
Now the essential assumption on $X$ is that if we now move to the set of homotopy equivalences of $\mathcal{C}((X, x_0), (Y, y_0))$ (i.e. the space of all continous maps $h:X\to Y$ such that $h(x_0) = y_0$), then
$[f] \cdot [g] := [f\cdot g]$
should define a group multiplication on the homotopy equivalences.
In the case of a sphere $S^n$ the example of such $\psi$ is (informaly) given by a contraction of the equator to a point. The resulting space can be easily identified with $S^n\vee S^n$. And for a given pointed space $(Y, y_0)$ the construction above yields a group naturally isomorphic to homotopy groups $\pi_n(Y, y_0)$.
There is a catch in all of that though. Notice how I said that the induced mutliplication should define group operation on homotopy equivalences. And what is a homotopy? It's a function $I\times X\to Y$. So at the fundamental level you always have $I$. The reason is it's just so damn good to model "fluent transformation from one function to another" with it.