Register templates as if they were classes.

(cherry picked from commit addff777d3365d45197acad0a9d0e5150d30560e)
After calling the dict function we must call PostLoadCheck
If the class is unknown, parse the template and try again.

(cherry picked from commit 2665fa23011c77c1653096637a79c1e9967b6480)
Don't autoload/autoparse during RegisterModule
Make sure the autoparse search again for symbol after a new module/library is loaded
Detect payload code also for template
Make sure to use the correct ClassDef when autoparsing