If we run a full reconcile and post, along with a full compression and the version that we used to publish feature layers to portal gets deleted and later recreated before the script finishes will the published feature layers on portal still work?
As long as the version is recreated before the service is started back up you should be good. Take a look at the following tool:
Compress Geodatabase Tool
The only functionality that does not exist is recreating the versions (if you choose the option to delete them). You could incorporate this into the script. The script will handle everything at that point (i.e. stop all services, reconcile/post/compress/delete versions/recreate versions, and then start all your services).
Retrieving data ...