If you set the default action for 'Track' - 'Left click' to "Deselect all items" it should do exactly the same as the custom action - it deselects the items and selects the track under the mouse cursor - no custom macro needed for that. For "Select track under mouse", I cannot reproduce the behavior shown in your GIF. There's might be an unlucky combination of modifier or preferences settings causing this. The easiest way to troubleshoot this would be an additional clean "portable" style install to experiment with, starting with fresh default settings.