hooks – override core files database, statement, connection


I’m trying to turns things in everyway in order to override those core files: Database, Statement & Connection in order to build a simple array of SQLQueries along with their results in order to intercept some weird mess into my website ..

#module.services.yml
services:
  module.database:    
    class: DrupalmoduleDatabaseConnection
    factory: DrupalCoreDatabaseDatabase::getConnection
    arguments: [default]

Sadly I find no other way than editing core files in order to perform this, has anyone some clever Idea ? There is the _query_alter hook, but not getting any hook like fetchCol, results etc ..