This is not an issue that is particular to After Effects, this is common nature in all tracking applications or Trackers, and this is where Mamoworld’s new Orient World for After Effects comes in.
In scenes tracked with AE’s 3D camera tracker, the ground plane of your scene is normally an oblique plane in 3D space. Orient World fixes this – with a single click you make a solid layer the ground plane of your scene and orient everything accordingly
Orient World will allow you to automate the orientation of your scene to something that is more appropriate and functional for your workflow. Mathias Möhl notes that Orient World is available on AEScripts as a Name-Your-Own-Price offering, and has also provided a tutorial showing the use of Orient World for After Effects.