Unit production time

I noticed that when a Phylarch bonus with unit training speed is activated the academy boost is neglected.

So if the Phylarch bonus is deactivated the unit training speed is estimated only with the academy level training speed for that unit. When the Phylarch bonus is activated the academy level is overridden and only the corresponding Phylarch bonus is calculated against unit training speed.

Is this supposed to work like that or I'm missing something?

If it's working like that IMHO it's a mistake, because scrolls of wisdom effect is cancelled if a player has Phylarch activated most of the time. Scrolls is a game resource which is scarce and also acquired via payment with GPs.

The correct thing would be when the Phylarch is activated to take into account academy level, too against unit training speed.

Your math is good, just not quite applicable for this calculation. When working with percent values for training times (and most other Sparta calculations for that matter), don't do what you would intuitively do:

[New Value] = [Old Value] x (1 - [Bonus%])

… but think sales tax calculation, where the "%" value needs to be extracted from the total price, such as …