This is one of the most essential features of a layout program. I recommend to have a look at Grid Calculator Pro for InDesign. This plugin calculates typographically correct grids based on a base line height of Body text, allows for modular and baseline grids, correct line-height-based margins, draws image alignment lines on x-height and many other features. Professionals use that plugin, not the rudimentary, but still not typographically sufficient InDesign features outlined here, even though that is a start. https://www.designersbookshop.com/grid-calculator-pro-edition.html
Also, conceptually, having a different grid on every page is a recipe for disaster visually. The purpose of a grid is to enable the designer to be consistent over vast amounts of pages. This is not a drawing program like Affinity Designer where I design a poster or small publications at best, this is a program meant for hundreds of pages. The focus must be on reusability, smart rescaling, snapping, grids, masters, styles (object styles are missing as well!), import features.
That Affinity is lacking ANY sort of grid calculator is dissapointing and a reason for me to stay away. This is the one thing that is a huge pain in InDesign.