It seems that the state of this option can only be obtained by setting a notifier on the align event and reading the handle after the user has done alignment at least once. Moreover, I did not find a way to force it - if I try to execute the align command with d.putBoolean(s2t( 'alignToCanvas'), true), then we will get an error if the selection-based alignment mode is selected (the same if we write the command into an action).
However, if you just need to understand which mode is currently active, then you can wrap it in try...catch and determine the active mode this way (you need to make sure that a selection is not created, since there will be no error if it exists).
You can also set a notifier on the align event and read the descriptor that will be passed to the script (it will explicitly indicate the active align mode). However, this method is less preferable, since we can get data about the event only after the user performs manual alignment.