How do I get a python script to run after the .blend file loads from the command line?
Command line arguments are run in the order they are given. So at the minute, yes, the Python file is being run and then the 'test.blend' file is being opened.

To fix this you just need to put the blend file part of the command first and the Python file after:

blender test.blend -P test.py


Now your file is opened then the Python commands are run in that opened file.