This is known as the formal criterion for "formal smoothness." In [this stacks project entry][1] they prove that a morphism of schemes (in your case $\text{Spec }A \to \text{Spec }k$) is smooth if and only if it's formally smooth and locally finite presentation. 

Aside from philosophical importance, it's often easier/more intuitive to check this formal criterion than to check the dimension of $\Omega_{\text{Spec }A/\text{Spec }k}$ or use a Jacobian. In the same stacks project tag, they say: 

> Michael Artin's position on differential criteria of smoothness (e.g., Morphisms, Lemma 01V9) is that they are basically useless (in practice).

Let's suppose $\text{Spec }A$ were instead a moduli space $\overline{M}$, e.g. of curves. Then to check $\overline{M}$ is smooth (if we know finite presentation), we need only consider an infinitesimal extension $S \subseteq S'$ coming from $B' \to B$ as in your question, and try to extend a curve over $S$ to a curve over $S'$. 

If you want to build the cotangent complex of $X = \text{Spec } A$ (or equivalently the "normal sheaf") but $A$ is not smooth, the first step is to replace $A$ by a smooth $k$-algebra mapping to it, say $k[A]$. Even if some $A \to B$ doesn't factor through $B'$, $k[A] \to A \to B$ certainly will (by choosing a set-theoretic preimage in $B'$ of the image of $A$ in $B$) and so the "problem" obstructing a factorization of $A \to B$ can be traced to the kernel of $k[A] \to A$. I highly recommend [this stacks project article][2] that carries this out as concretely as possible. 

You can get specific cohomological obstructions to such a factorization by continuing with a simplicial resolution: $\cdots k[k[A]] \rightrightarrows k[A] \to A$. One can even think of this as "covering $A$ by smooth algebras" in a topological sense using [this Jonathan Wise article][3]. 


  [1]: https://stacks.math.columbia.edu/tag/02GZ
  [2]: https://stacks.math.columbia.edu/tag/08KW
  [3]: https://arxiv.org/abs/1101.4069