Can I get integers from a dynamic query using fetchAllKeyed?
The issue here is that PDO returns strings, even for integer columns. Drupal handles this issue by providing the Typed Data API, which provides data typing used within Drupal, rather than PHP-level data typing.

In the Drupal 8 paradigm, database queries are generally made to query entity IDs, which are then used to load entities. Data is then retrieved from the entity. The Entity API on the back end will handle the setting/getting of the fields on the entity. The fields on the entity will all be of a Typed Data API data type, providing a consistent method of dealing with data types on the Drupal level.

The method of retrieving IDs, and loading entities is done for the sake of efficiency, as entities are cached, and may be loaded from backends such as Redis, therefore being much faster than retrieving the entity data from the database. And because fields are typed, it gives a consistent API for dealing with various data types, that can also be extended to provide additional data types through contributed modules.

So the question here becomes about what you are trying to do, and how you are trying to do it. If you are working with data that you've been saving to the database yourself, then you can switch to the Drupal way, and create a custom entity type then use the Entity API to set/get the field data. Or, if you are retrieving data from the DB that Drupal has saved there, it likely belongs to an entity that you should be retrieving, rather than directly retrieving the field data.