Have a look at lib/moodle;ib.php and you see the data can come from tables (config, config_plugins), a cache, but also from the forced setting in the config.php file ($CFG->forcedplugin). This is the reason why the get_config function is preferred: it allows admins to override or force settings.
A plugin is newer when the version setting in config_plugins table is lower than the value in the version.php file of your plugin (cfr upgradelib.php)