You only get a warning about missing critical item when you land and disembark and you didn't take with you a critical item needed for completing the mission (i.e. Power Regulator). I never saw a similar alert for when you try to leave the planet without the mission objective item that was given to you (or that you picked up) after completing the mission.
BTW, I never "sell all" at the bartender, only trade in specific items when I'm missing mats needed for upgrades (mentioning it just in case it matters).
The warning of a missing critical mission item is/ has been bugged since alpha and never fixed. On a settlement restore mission where you have multiple power regulators in your inventory, selecting the wrong one ?????????? gives this warning after your taxi has left. BUT using any power regulator will complete the mission. In other words a power regulator is a power regulator ! unless it's coded by FDev's, in which case you can only use the specific regulator assigned by the mission. Ridiculous as any will do but not considered an important game breaker to actually warrant fixing. Exactly the same as all the game breaking bugs that still affect gameplay that have been 'forgotten' by Frontier.
(rocks in the middle of buildings, assets 'lost' from backpacks, Atmosphere controls not switching on after restoring power (requiring reboot which then means empty lockers - good job FDev), Docking confirmation being given BEFORE it's requested by Apex shuttle, Black screen when trying to exit game (claim to have fixed but still a problem) etc, etc, etc, the list is endless. Oh and they still cannot fix the stutter/ fps lag caused when ships land at settlements even with RTX powered cards. But don't worry they are powering ahead with the console version even if the PC one is still a mess (oh goodie)