Relevancy check is not broken

If mined in the same block, spending transactions always come after the
transactions containing the outputs they spend. Source:

http://bitcoin.stackexchange.com/questions/3870/what-order-do-transactions-appear-in-a-block-is-it-up-to-the-miner