This rule may prevent and require some actions, but others are not clear.
Whether a creature is a friend or an enemy, you cannot voluntarily end your movement in its space …
For me, if you are aware of some set of actions that allows you not to end your movement there and do not take those actions, then you are voluntarily do not take them, and then you are voluntarily ending your turn in the space of another creature. Therefore, in scenario 1, you will be asked to perform the Dash action or the cast foggy step If I could like any decision not to use them I would be willing.
On the one hand, entering the space of a creature does not warranty that his movement ends there (perhaps a spell will be cast, or the difficult terrain was false, or he will succeed in the caltrops save cast) so that he can always enters the space of a creature.
On the other hand, moving anywhere has the potential to make your movement end in another creature's space (maybe a spell will be cast) so you can never move anywhere, never.
Clearly, these ideas cannot work together, so using "guarantees" will not help us. However, the rule about moving around creatures should definitely apply. sometimeand as there is never a absolute guarantee that something will end your movement or not in the space of another creature. I adopted the rule to apply when something is very likely have one result or another.
This brings us to the following metrics:
"If there is a very high possibility that your movement ends in another creature's space, you cannot enter its space."
"If there is a very high possibility that your movement does not end in the space of another creature, you can enter its space."
Unfortunately, there is no good way to determine what counts as "a very high possibility" and, therefore, applying this metric would depend on a GM. Nor do we have a way to deal with scenarios in which there are similar chances that your movement will end and not end.
By using this metric, we can see that the difficult terrain scenario has an almost guaranteed result that you are trapped there and, therefore, you cannot enter that area (but if you still had your action, then you could, it would only require you to take the Script Action after doing so).
The caltrops scenario would technically depend on your skill saving bonus and almost always have a significant chance of ending or not moving, therefore, the metrics I made could not be applied.
In situations like this, the rules are not clear and would depend on your GM.
The rule forces you to leave a creature's space by any means necessary and we can conclude that you may or may not enter a creature's space depending on whether your ability to stop there is extremely low or extremely high respectively.