so, miners must confirm older transactions first, with or without fees; Or they will be risking to mine blocks that are dependent of transactions in the pool (not confirmed yet), and invalidating that block they are working on. Is this right?
Yes, if I understand you correctly.
One. Miners will confirm any "new" transaction (the "child") that already has a prior confirmed transaction (the confirmed "parent").
Two. If you place a reasonable miner fee in the "new" transaction, miners will place your "new" transaction in the next block, in theory.
That "new" transaction
must have a "confirmed" prior transaction. The "child" can not come before the "parent".
Three. If the "parent" transaction is not confirmed (maybe there was no fee attached), the "child" will not be confirmed
with or without a fee.
(As a side note: CPFP is a different story and you should not expect this to work for you ever, but might be different in the future.)
Your statement about a block being invalid is different. Do not worry about invalid blocks in relation to your original question.
Invalid blocks have to do more with the (1) miners racing to publish and thus "orphaning" or (2) miners accidentally(or intentionally) forking the blockchain.
If miners did accept unconfirmed "child" over unconfirmed "parent", I think, but not sure, all other nodes and etc will reject that block immediately.
That would be a violation of the Bitcoin protocol, I believe.
I hope this answers your question.
Edits: Spelling and additions.