Note that you have to add the buttons yourself in GTK4, maybe that is your main issue. Well I created an application window first, I am not sure if launching a dialog from program startup works when there is no parent window. Note: When you use GTK4, you may consider using the modern app style and not the legacy program shape with gtk_init().
This was originally a gtk3 program which didn’t have any loop or GtkApplication. Anyways, adding g_main_context_iteration() in loop helped.
BTW, I see the filechooser dialog now but when I press Ctrl+L it says “Enter location or URL” but then when I type location e.g. /home/user/Downloads/foo etc. it starts searching for the entered text instead of treating it as a location path.