You should be able to create a script that generate a Tilemap at runtime. There is multiple functions like Tilemap.SetTile or Tilemap.BoxFill that can add tile at runtime.
For your issue with the TilemapCollider2D, you should be able to create it before hand. The component will refresh itself whenever you modify the content of the Tilemap. Alternatively, you can use the GameObject.AddComponent function to add a component at runtime on a given GameObject.