Hi Diego Colombo,
I don't know which chip you are used, but as I know, our Kinetis K ,KL, KE chip all has the funtion which you need. It is when you configure the pin to other function, not the GPIO function,
you still can read the GPIOx_PDIR to get the pin logic value.
Actually, in the chapter GPIO of our reference manual, it has detail description like the following:

So, if you use the Kinetis K ,KL, KE chip, you don't need to switch to GPIO, just read it directly! I already verify it successfully!
Wish my answer is useful to you!
Best regards!
Jingjing