Is it possible to run the pre-installation scripts or the post-installation scripts during appx installation time? If it is possible how can we achieve this?
At the moment this is not possible. The only way to achieve something like this is to create something like a MSI wrapper around your AppX package and from the MSI run custom scripts before and after you install the AppX package (using another script, PowerShell for example).
I would not recommend such a solution, but in theory it is possible.