The answer to What are the limitation using before unload event? explains that:
The only way to guarantee your function will run to completion is to make sure you're writing synchronous code that blocks the event
In this particular example, the classes would be applied, but css transitions would most likely not show as they are completely separate to the javascript call and are not blocking.
If you would like your animations to show, then you would most likely need to either trigger a javascript function that runs for the duration of your animation but doesn't stop css animations, or change your animation over to a javascript function or library instead.
I've had success with a number of sites by using jQuery animations. In your case, it might look something similar to this:
window.onbeforeunload = function(){
$('.page-loader').removeClass("page-loader--hidden").hide().fadeIn(300);
};