Wordpress uses ezSQL to query the database. Technically, this is not a level of abstraction, but it takes part of the template code. ezSQL has an escape function, so I assume that Wordpress always called the escape function before executing the query. But to be sure, you need to take a look at the source code.
Here's how you avoid a line in Wordpress:
$safe_string = $wpdb->escape($unsafe_string);
source share