Custom page access configuration

I confirmed that regular pages are working with access filtering, if created through the dashboard and not linked with routes.yaml to a template. However, the template is where I am creating all of my code that I want to do the filtering on, so I need to figure out how to make that work.

Should I be using the data property on my route? If so, what would I use there?