A topological space is said to be $n$-connected if for every $0\leq k\leq n$, each map from $\mathbb S^{k}$ extends to $D^{k+1}$.
Here the $n$ is the highest dimension of a sphere.
A continuous map $f$ is said to be $n$-connected if for every $0\leq k\leq n$, each commutative square from $\mathbb S^{k-1}\subset D^k$ to $f:X\to Y$ is homotopic rel $\mathbb S^{k-1}$ to a map into $X$.
Here the $n$ is the highest dimension of a disk.
Consequently, $X$ is $n$-connected iff $X\to \bf 1$ is $(n+1)$-connected. This seems quite ugly.
Why do we define things this way?
Unravelling the definitions you give, we find a much cleaner statement. Firstly we need to add to your definition the requirement that $f$ is a basepoint-preseving map that induces an isomorphism on path components.
Then a space is $n$-connected if and only if $\pi_iX=0$ for each $0\leq i\leq n$. On the other hand, a map $f:X\rightarrow Y$ is $n$-connected, or an $n$-equivalence, if the induced maps $f_*:\pi_iX\xrightarrow{\cong} \pi_iY$ are isomorphisms for each $0\leq i< n$, and $f_*:\pi_nX\rightarrow \pi_nY$ is onto.
To see the equivalence recall that giving an extension of $\alpha:S^{k-1}\rightarrow X$ to a map $\tilde\alpha:D^{k+1}\rightarrow X$ is equivalent to a giving a null-homotopy of $\alpha$. Therefore the injectivity conditions , if $\alpha\in\pi_{k-1}X$ and $f_*\alpha\simeq 0$ then $\alpha\simeq \ast$, follow from immediately. The surjectivity conditions follow by representing $\beta\in\pi_{k+1}Y$ by a relative class $[(D^{k+1},S^k),(Y,\ast)]$ and using that fact that $f(\ast)=\ast$.
In particular, by this definition, for a space $X$, the map $X\rightarrow \ast$ is $(n+1)$-connected if and only if
$$\pi_kX=0,\qquad 0\leq k\leq n.$$
In particular $X$ is $n$-connected. So we find agreement.
Now, to your question. Consider the inclusion of the basepoint $\ast\rightarrow X$. For this map to be $n$-connected we require
$$\pi_kX=0,\qquad 0\leq k\leq n.$$
In particular $X$ is also $n$-connected.
So, to answer you question, that is the reason we define things like this, namely because we consider the map $\ast\rightarrow X$. Taking this map as motivation for the definition makes better sense than considering $X\rightarrow\ast$, since for the former map it coincides with the more concrete definition you give, that every map $S^{k-1}\rightarrow X$ is compressible in $X$ to a point.