Zend certified PHP/Magento developer

Magento stock status index inconsistent with product table after reindexing

I migrated from Magento 1.8.1 to 2.2.3.
Problem: in the shop I see simple products that are out of stock even when I filter on stockstatus = in stock.

What I have found out, is that the index for product stock status is wrong. It has value in stock, where in the product table it isn’t. Vice versa.
I have reindexed using both the magento backend (setting is Save on update) and through SSH, but no affect. The stock status index value remains incorrect.
I have updated it manually trough an Sql update query on the index table. Then it is correct (and also displayed correct in my shop using the stock status filter), but when I reindex, these values do become incorrect again.

Also for new products (I mean not migrated products), stock status is not updated after a customer buys the last piece in stock of that product. It is updates in the product table to Out of stock, but in the index table it remains In Stock. I have setting Save on update in the Magento backend in the Index management section. Also after manually reindexing, the index does not change.

Two questions:

It looks like the index is getting the wrong information to reindex. How can I see which source table on which database the index is using to reindex?

Any idea how to solve this problem? Can I rebuild the indexes (delete and recreate them)?

Any help is highly appreciated!