How to properly recognize a session id generated by drupal?
Drupal will let you override the default session handler using the session_inc variable. This is what Drupal actually uses to bootstrap the session:

require_once DRUPAL_ROOT . '/' . variable_get('session_inc', 'includes/session.inc');


So to replace that with your own, set the variable to your own path:

variable_set('session_inc', 'sites/all/modules/MYMODULE/session.inc');


And re-implement the functions from the core session.inc in your custom file, making changes where necessary.