what I understood with the migration from flash to HTML5 it was more or less copy/paste and not completely rewritten.
There are two interpretations of that "copy/paste".
First is to copy code lines that controlled Flash to code lines into html. This is not possible. Though my impression of their first attempt was, that they had hoped for that. However, Flash is an app that runs on the player's computer and must be triggered by commands (and parameters) to change what we see on the screen.
Different from that, html ist not the control, but the RESULT. Html code is the result of what the server programs calculated. So many of the algorithms that create what we see, must be prepared on the server. Version 5 of html brought a lot of new functionality to change things on the screen, colors, sizes, positions and even data and animations, but the html code line must be prepared and (almost) completely "written" by the server code.
Second meaning of copy/paste is: not to copy the code lines, but the algorithms. And that is, what they finally did (seem to have done).
Example: if you want to add two numbers, one programm language might need that written as "c := a + b;" while another one needs that as "sum(a,b)". In such cases, the algorithm is to add a and b, but the code line must be rewritten.
And here is one possible problem: if the algorithm is correctly transferred, there might have been a bug in the calculation of b. So if the value of b is wrong, the very same but will be in the flash version and in the html version. During the transition they might have looked at the variables a and b, and found to better have used d instead of b ... that would have fixed that bug, but it looks like they didn't do that, so we still have a lot of bugs known in the flash version already.
(But it's understandable ... HMR said it: they needed time, much time, especially when it came to the third attempt when a year had already gone ... no time to quickly look up and change bugs, even if they were just typos)
So, simply said: Flash (and engines like Unity) so much of the work on the computer of the player, while html code comes from the server and must already contain most of the stuff that will happen on the screen.