Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?

It may seem like WordPress is intelligently redirecting old URLs, but what it’s doing is just guessing, and mostly getting it right due to the nature of your posts and URL structure being unique enough for it to guess correctly. There are cases where it’ll get this guess wrong.

You can see where it does this in WordPress source, the function is aptly named redirect_guess_404_permalink.

API functions don’t guess, it’s either an exact match or it’s not. If you think about this, it makes sense. You could duplicate that functionality and do the same LIKE query on post_name if you want to try to find a possible match the same way WordPress does.