CodeIgniter Active Record Subqueries
Personally I think your going the wrong way about things, you can easily pass in a query string into the select method and set the 2nd param to true to bypass backticks.
So the output would place the sub query string within the main query select.
I would do something along the lines of:
class MyModel extends Model
{
    public function getRows()
    {
        //Create a subquery and render it to a stirng
        $sub = $this-&gt;db-&gt;select('number')-&gt;from('numbers')-&gt;where('numberID', 2)-&gt;_compile_select();

        //Clear the data from the CI Arrays
        $this-&gt;db-&gt;_reset_select();

        //Build the main query passing in the sub-query and disabling backticks
        $this-&gt;db-&gt;select(&quot;word,(&quot; . $sub . &quot;)&quot;, false)-&gt;where('wordID', 3);

        //Get the results
        $result = $this-&gt;get(&quot;words&quot;);
    }
}

Sources:

@ _compile_select()
@ _reset_select()

Firstly let me just state that the code above may not be fully working as i have not test machine a.t.m, but I do know that this is possible and you do not need all the extra logic specified.
It seems pretty simple to me without creating new $db's.
I also would recommend you encapsulate the logic above into a class so you can pass the object's around and make life simpler as the above is a POC

Concept:
class InnerQuery extends CI_DB_active_record
{
    public function __construct()
    {   
    }

    public function __call($method,$params = array())
    {
        //Remove methods that modify the database
        switch(strtolower($method))
        {
             case 'get':
             case 'count_all_results':
             case 'get_where':
                 trigger_error(&quot;Cannot use {$method} in InnerQuery&quot;);
             break;
        }
        return $this;
    }
    
    public function compile()
    {
        return &quot;(&quot; . $this-&gt;_compile_select() . &quot;)&quot;;
    }

    public function __tostring()
    {
        return $this-&gt;compile();
    }
}

Ok so the above class extends the same object as $this-&gt;db in your controller, so you can use all the methods to build a query such as
$this-&gt;InnerQuery-&gt;select(&quot;item as item_key&quot;)-&gt;from(&quot;inner_table&quot;)-&gt;where(&quot;foo&quot;,&quot;zed&quot;);

You should disable the parent methods that change the database or run any queries as this is only used to build a select string.
so you should in thoery be able to do:
$this-&gt;db-&gt;select(&quot;word&quot;)-&gt;where('wordID', 3);
$this-&gt;db-&gt;select($this-&gt;InnerQuery,false);

which would use the DB class to build your query and can just be passed into the outer select and the __tostring will return the (SELECT ...) with braces and pass it into the main query.