South Korea's impeached President Yoon Suk-yeol has arrived at court to contest an extension to his detention over a failed declaration of martial law.