[MINOR] Inline the partition path logic into the builder (#5310)