Adding a related product to a configurable product makes the configurable product simple, not configurable

Steps to reproduce the bug

Step 1

Open a configurable product in the Magento 2 backend:

Step 2

Open the «Related Products, Up-Sells, and Cross-Sells» section:

Step 3

Press the «Add Related Products» button:

Step 4

Select a product to be related and press the «Add Selected Products» button:

Step 5

The related product is shown in the «Related Products» section. Press the «Save» button:

Step 6 (BUG)

The saved product is become simple, not configurable