You shouldn't have to do this.. $rs["hosts"][0] should always be primary (since it has by far the highest priority).
The point was to be able to assume $rs["hosts"][>0] were secondaries so you wouldn't have to taint the connection pool, potentially hiding other bugs.