chess.com is just bugged
for example, if you have a knight and opponent has a rook pawn it will still automatically declare insufficient mating material even though its possible to mate
No, it wont.
What it will do however, if the player with the rook pawn runs out of time, is it will declare a draw due to insufficient material. This is normal practice according to USCF rules which chess.com seems to use as opposed to FIDE.
Look on the bright side...you won the game! Your opponent should have accepted the draw! :p