Reason why SQL Max memory expansion seems slow when migrated to newer version of SQL server
This seems that memory allocation extension somehow is very slow on this server

More likely that you had query plans on SQL 2012 that required scanning more data than the plans on SQL 2017, and a side-effect of those scan-heavy plans is that they loaded most of your database into memory.
Or your disks could be slower, requiring more time (PAGEIOLATCH wait time) to to load the database pages into the page cache.