Some mathematical notation actions can't undo in a notebook

Hello, I am using mathematica v12.3
I am new to mathematica and staring to learn. I am writing some math notes which include text and some equations.
I know that in Text cell I can CTRL+( and start typing some equations and they would appear in mathematical notation, But sometimes if some equation is highlight and I accidentally press CTRL+( key, the equation convers to some kind of markup code. for example
x^2+9-50
would become

\!\(
  \*SuperscriptBox[\(x\), \(2\)] + 9 - 50\)

and strange thing is most of the time this actions won’t undo with CTRL Z .also the undo is greyed out in Edit tab.. I have to close the file and reopen it get it to the state it was last saved.

I want to know what is this markup code, and how can I undo this action, and why it does what it does, why only on highlighted text? on empty area it works as expected.

Thanks

String box representation is explained in the following section of a tech note:

CTRL+( operates on selected text, if text has been selected, creating an inline cell with the selected text as content; otherwise, it creates an empty inline cell with a placeholder, which is removed if you click elsewhere without typing content into the inline cell. BTW, I don’t get the behavior you describe when I try it; in fact, undo works for me.