The imported certificate's Days Valid field is displaying wrong value -- it is showing 6090 days for a certificate which has 36524 days validity (100 years).
The reason for this seems to be the date handling in the OS caused by using 32-bit Unix time_t structure (a.k.a. the Year 2038 Problem) -- the Invalid After field for the certificate in question is showing Jan/01/2038 12:47:58 when it should be showing Apr/30/2121 12:47:58.
The easiest solution is to upgrade to Linux kernel 5.6 and glibc-2.32 or higher where 32-bit apps can use 64-bit time_t just by recompiling. Additional details about full userspace support for 64-bit time_t and other ways of handling this if you are using syscalls directly are available here.
Note that your using of 32-bit time_t is certainly affecting other functions as well, not just certificate validity checks.