Yes. Do whatever achieves you goal, while minimizing harm, as in every other aspect of life.
Arguably, "sliding" a finger from a black key onto a white key makes it more difficult to achieve legato.
So when there are other options, it is not usually adviced. But sometimes legato is not a required virtue, or the situation is too difficult or impossible to "cross one finger underneath another".
This mostly happens when you have no time to "cross the finger" because the tempo is fast, or disallowed to do so for other fingers are pressing another note(s).
And most frequently this technique applies to the thumb, because one's thumb (in either hand) is effortless to be "placed onto" something with precision.
(Difficult to express this verbally, as I am not English native XDDD )
You can see either is true in the following examples. It took me some time to find these examples.
It is most persuasive to cite those passage when a score-press editor suggests so. (I believe these are all Henle Urtext edition, but I am not sure, as they are copies (shh...!!).
The tempo of this section of Chopin Ballade 3 is fast, and pedal is used, allowing possibility of sliding l.h. thumb.

The tempo of the finale of Beethoven op.101 is fast, and in either case, 5 is used and it is barely possible to "stretch his hand" and cross finger.
The 2nd red arrow is closer to the spirit of your cited example.

The tempo of the finale of Beethoven op.101 is very fast, and the insane requirement of r.h. to play another voice makes it only solution to slide r.h. thumb.
The 2nd and 4th red arrows are closer to the spirit of your cited example.
This is considered one of the most difficult piano pieces of all time, so be warned if you want to try this. (I have not.)
