The correct answer to this question is going to vary heavily based on what the simulacrum is a copy of, and from there, how the DM running the game choices to interpret the situation. It is important to keep in mind that while a simulacrum is created by the player and must act within the confines of the spell that made it, it is still technically an NPC and thus falls well within DM-fiat to arbitrate issues such as this. That said, we can still look closely at the spell to examine how such an event will most likely play out.
From the spell description, emphasis mine;
You shape an illusory duplicate of one beast or humanoid that is within range for the entire casting time of the spell. The duplicate is a creature, partially real and formed from ice or snow, and it can take actions and otherwise be affected as a normal creature. It appears to be the same as the original, but it has half the creature’s hit point maximum and is formed without any equipment. Otherwise, the illusion uses all the statistics of the creature it duplicates, except that it is a construct.
This passage illuminates one of two important factors that must be addressed before an answer to this question can be determined, even theoretically. The second important factor can be drawn from the quote in the original question.
1.) The simulacrum is a creature that is a duplicate of either a beast or a humanoid, that uses ALL of the statistics of the creature it duplicates, save that it is of the construct type. Game statistics include the creature's intelligence, strength, etc., but also its alignment, and physical needs. As it is a duplicate of either a beast or a humanoid, it must breath, eat, and sleep.* It will also age the same as the original, growing older over time. All of these factors can give us insight into how it may respond to any given situation.
2.) As stated in the original question, the simulacrum is friendly to you and creatures you designate. This is important because it is a condition imposed on the creature by the spell itself, and thus, remains a constant of its existence. However, it also means that, unless specifically designated, the simulacrum is not innately friendly to any other creatures.
These two factors, combined, create the framework for how to answer the question of what any given simulacrum would do when forced to make a decision of their own volition. To begin with, the basis of what the creature would do is largely based on what the original creature would, itself, do in that situation. It has the same intelligence, wisdom, skills, abilities, and alignment of the original. If the original creature was a lawful good paladin whom had taken the oath of devotion, then it could be assumed it would act in keeping with that oath as it would otherwise lose its abilities. If the original creature were, instead, a dog, then once the magic compelling it to complete its order ceased compelling it, it would very likely just continue living the life of an average dog. If, however, the original creature was some manner of chaotic evil cleric whom the party had captured and made a simulacrum of, then it would be reasonable for the simulacrum to seek to follow the will of the chaotic evil god granting it its power, likely doing everything it can to avoid its creator as it must obey their orders when given. Apart from that, assuming the creature is intelligent enough to understand as much, it would also presumably take into account that it can never naturally heal from any injuries it sustains and that any spells it has are a limited resource. Other resources** could still be regained as normal.
The only other variable in this is the second factor; The creature is friendly to its creator, if no one else. This is where much of the variance in the simulacrum's behavior will come from, in contrast to how the original would otherwise act. This is not the same as being 'charmed' by its creator, or necessarily even loyal. As such, how any given simulacrum responds to being 'friends' with a creator who has the ability to issue it commands it cannot refuse is likely as dependent on what the original creature was as any of its other actions. A dog would likely never betray something it considered a 'friend,' but an oathbreaker paladin might feel compelled to do so at the first opportunity.
*Unless some aspect of the original makes one of these unnecessary, such as elves needing to trance instead of meditate. The DM may also rule that, as a construct, the simulacrum is exempt from these needs but there are no rules actually stating this outright.
**Class features like action surge, sorcery points, channel divinity, and features such as breath weapons and spells granted by its race, etc