Grammarly is right because the sentence is grammatically correct. Your teacher has a point because there are several issues with the usage of like in this sentence.
According to the Cambridge Dictionary, the word like, meaning "in the same way or manner as" can be a used either as a preposition or a conjunction. Here are examples of the two usages:
The diamond sparkled on her finger like a snowflake in the sun. - preposition
A woman needs a man like a fish needs a bicycle - conjunction
There are, however, constraints in the way that we use the conjunctional form: it does not sound natural if we use a different verb in the main and subordinate clauses, for example.
She sings like her baby brother screams
The sentence is grammatically correct, but it sounds unnatural: in this case, this unnatural feeling can be used to emphasise the humorous nature of this comment.
Your sentence is a conjunctional usage of like, but the verb in the main clause is "have not immediately conformed" and the verb in the subordinate clause is "was hesitant". In addition, fronting the subordinate clause makes it feel more unnatural, harder to understand and more likely to get a knee-jerk "that's wrong" reaction.
You can eliminate these two problems by putting the main clause at the front and then using the same verb:
Have you ever been hesitant when society has placed an expectation on you, like Pearl was [hesitant] when she was expected to accept her father?
There is one final consideration: while we use the prepositional form in spoken and written English, the conjunctional form is, for some reason, regarded as less acceptable in written English. Instead, we use as or in the same way as.
Have you ever been hesitant when society has placed an expectation on you, as Pearl was [hesitant] when she was expected to accept her father?
With as there is no particular problem about using different verbs in the main and subordinate clauses:
Have there been times when you have not immediately conformed when society has placed an expectation on you, as Pearl was hesitant when she was expected to accept her father?