What I said has nothing to do with the Cookies itself, it's about how generated sessionID (what you asked for) acts as a glue between client's browser and your server.
Now what you provided here with session in plain PHP does not make any sense to me, but here it is - Phalcon's version of that code logic of yours:
$di->setShared('session', function () {
$request = $this->getRequest(); //we need Request service
$session = new \Phalcon\Session\Adapter\Files(); //or any other supported adapter
$session->setName('MySessionCookieName');
$session->setId($request->getQuery('session_id', 'alphanum', $session->getId())); //filter and default value are optional, as I have no clue what you want to achieve with this
$session->start();
return $session;
});
$notSureWhy = json_encode($di->getShared('session')->get('youNeedToKnowKeyWhichHoldsYourSessionDataHere'));