The size is already based on the Pokédex size. However, it has to be based partly on the sprites, as a Pokémon with a small sprite would appear too small otherwise.
The resize takes into account the dimensions of the image file (usually 128x128), the height of the actual sprite (i.e. not counting pixel rows with only transparent pixels), the height of the trainer sprite, the height given in the Pokédex, and the trainer's height (currently the same as in D/P; i.e. 1.4m).
It's an issue with how the Pokédex height is measured on long Pokémon and their poses in the sprites, not with the script. If I resprited Gyarados with its head at the top, tail at the bottom, and body straightened out, it would appear at the correct size. However, it would then look really really awkward; would you rather have a slightly inaccurate Size page, or a ridiculous sprite appearing in battle, the summary screen, and Pokédex? :P
Unless I can get hold of the data controlling this used in R/S/E, I'll leave it like this.