You are absolutely correct you have created a happens-before relationship. In general
a = X ; ( X is some constant or expression not involving a & b ) b = Y ; ( Y is some constant or expression not involving a & b )
above two can be reordered by the JIT
But a = X ; b = a * Y ;
Will not be reordered. Which is pretty much what you have done in your correction.
Other way to fix your problem would be to declare wayPoints volatile. If you declare wayPoints as volatile, write to volatile ( wayPoints) would not be reordered with other memory operations ( someThread.addToQueue() ) in your original program order.